From 4d92783f12889b64520786962a1930f3c43448d2 Mon Sep 17 00:00:00 2001 From: Samuel Schlesinger Date: Mon, 15 Oct 2018 22:56:41 -0600 Subject: [PATCH 1/2] Use relative path so that we properly apply --base-href. --- projects/ngx-translate/http-loader/src/lib/http-loader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/ngx-translate/http-loader/src/lib/http-loader.ts b/projects/ngx-translate/http-loader/src/lib/http-loader.ts index 0afd4a9..ea92777 100644 --- a/projects/ngx-translate/http-loader/src/lib/http-loader.ts +++ b/projects/ngx-translate/http-loader/src/lib/http-loader.ts @@ -3,7 +3,7 @@ import {TranslateLoader} from "@ngx-translate/core"; import {Observable} from 'rxjs'; export class TranslateHttpLoader implements TranslateLoader { - constructor(private http: HttpClient, public prefix: string = "/assets/i18n/", public suffix: string = ".json") {} + constructor(private http: HttpClient, public prefix: string = "./assets/i18n/", public suffix: string = ".json") {} /** * Gets the translations from the server From 13417eff2f856bd36be5c5243584d2d5166a5e86 Mon Sep 17 00:00:00 2001 From: Samuel Schlesinger Date: Mon, 15 Oct 2018 23:03:12 -0600 Subject: [PATCH 2/2] Fix tests to use relative paths. --- .../ngx-translate/http-loader/tests/http-loader.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/ngx-translate/http-loader/tests/http-loader.spec.ts b/projects/ngx-translate/http-loader/tests/http-loader.spec.ts index 7ca061b..19481ff 100644 --- a/projects/ngx-translate/http-loader/tests/http-loader.spec.ts +++ b/projects/ngx-translate/http-loader/tests/http-loader.spec.ts @@ -46,7 +46,7 @@ describe('TranslateLoader', () => { }); // mock response after the xhr request, otherwise it will be undefined - http.expectOne('/assets/i18n/en.json').flush({ + http.expectOne('./assets/i18n/en.json').flush({ "TEST": "This is a test", "TEST2": "This is another test" }); @@ -69,11 +69,11 @@ describe('TranslateLoader', () => { expect(translate.instant('TEST')).toEqual('This is a test 2'); }); - http.expectOne('/assets/i18n/en.json').flush({"TEST": "This is a test 2"}); + http.expectOne('./assets/i18n/en.json').flush({"TEST": "This is a test 2"}); }); // mock response after the xhr request, otherwise it will be undefined - http.expectOne('/assets/i18n/en.json').flush({"TEST": "This is a test"}); + http.expectOne('./assets/i18n/en.json').flush({"TEST": "This is a test"}); }); it('should be able to reset a lang', (done: Function) => { @@ -101,6 +101,6 @@ describe('TranslateLoader', () => { }); // mock response after the xhr request, otherwise it will be undefined - http.expectOne('/assets/i18n/en.json').flush({"TEST": "This is a test"}); + http.expectOne('./assets/i18n/en.json').flush({"TEST": "This is a test"}); }); });