ngx-translate-multi-http-loader 7.0.2 → 7.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/esm2020/index.mjs +3 -3
- package/esm2020/lib/multi-http-loader.mjs +21 -21
- package/esm2020/ngx-translate-multi-http-loader.mjs +4 -4
- package/fesm2015/ngx-translate-multi-http-loader.mjs +18 -18
- package/fesm2015/ngx-translate-multi-http-loader.mjs.map +1 -1
- package/fesm2020/ngx-translate-multi-http-loader.mjs +18 -18
- package/fesm2020/ngx-translate-multi-http-loader.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/lib/multi-http-loader.d.ts +13 -13
- package/ngx-translate-multi-http-loader.d.ts +5 -5
- package/package.json +2 -1
package/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# ngx-translate-multi-http-loader
|
2
|
-
|
3
|
-
This library was generated with [Nx](https://nx.dev).
|
4
|
-
|
5
|
-
## Running unit tests
|
6
|
-
|
7
|
-
Run `nx test ngx-translate-multi-http-loader` to execute the unit tests.
|
1
|
+
# ngx-translate-multi-http-loader
|
2
|
+
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
4
|
+
|
5
|
+
## Running unit tests
|
6
|
+
|
7
|
+
Run `nx test ngx-translate-multi-http-loader` to execute the unit tests.
|
package/esm2020/index.mjs
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
// export * from './lib/ngx-translate-multi-http-loader.module';
|
2
|
-
export * from './lib/multi-http-loader';
|
3
|
-
//# sourceMappingURL=data:application/json;base64,
|
1
|
+
// export * from './lib/ngx-translate-multi-http-loader.module';
|
2
|
+
export * from './lib/multi-http-loader';
|
3
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL25neC10cmFuc2xhdGUtbXVsdGktaHR0cC1sb2FkZXIvc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGdFQUFnRTtBQUNoRSxjQUFjLHlCQUF5QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci5tb2R1bGUnO1xyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9tdWx0aS1odHRwLWxvYWRlcic7XHJcbiJdfQ==
|
@@ -1,21 +1,21 @@
|
|
1
|
-
import { forkJoin, of } from "rxjs";
|
2
|
-
import { catchError, map } from "rxjs/operators";
|
3
|
-
import merge from 'deepmerge';
|
4
|
-
export class MultiTranslateHttpLoader {
|
5
|
-
constructor(http, resources) {
|
6
|
-
this.http = http;
|
7
|
-
this.resources = resources;
|
8
|
-
}
|
9
|
-
getTranslation(lang) {
|
10
|
-
const requests = this.resources.map(resource => {
|
11
|
-
const path = resource.prefix + lang + resource.suffix;
|
12
|
-
return this.http.get(path).pipe(catchError(res => {
|
13
|
-
console.error("Something went wrong for the following translation file:", path);
|
14
|
-
console.error(res.message);
|
15
|
-
return of({});
|
16
|
-
}));
|
17
|
-
});
|
18
|
-
return forkJoin(requests).pipe(map(response => merge.all(response)));
|
19
|
-
}
|
20
|
-
}
|
21
|
-
//# sourceMappingURL=data:application/json;base64,
|
1
|
+
import { forkJoin, of } from "rxjs";
|
2
|
+
import { catchError, map } from "rxjs/operators";
|
3
|
+
import merge from 'deepmerge';
|
4
|
+
export class MultiTranslateHttpLoader {
|
5
|
+
constructor(http, resources) {
|
6
|
+
this.http = http;
|
7
|
+
this.resources = resources;
|
8
|
+
}
|
9
|
+
getTranslation(lang) {
|
10
|
+
const requests = this.resources.map(resource => {
|
11
|
+
const path = resource.prefix + lang + resource.suffix;
|
12
|
+
return this.http.get(path).pipe(catchError(res => {
|
13
|
+
console.error("Something went wrong for the following translation file:", path);
|
14
|
+
console.error(res.message);
|
15
|
+
return of({});
|
16
|
+
}));
|
17
|
+
});
|
18
|
+
return forkJoin(requests).pipe(map(response => merge.all(response)));
|
19
|
+
}
|
20
|
+
}
|
21
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXVsdGktaHR0cC1sb2FkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL25neC10cmFuc2xhdGUtbXVsdGktaHR0cC1sb2FkZXIvc3JjL2xpYi9tdWx0aS1odHRwLWxvYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEVBQWEsUUFBUSxFQUFFLEVBQUUsRUFBQyxNQUFNLE1BQU0sQ0FBQztBQUM5QyxPQUFPLEVBQUMsVUFBVSxFQUFFLEdBQUcsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBQy9DLE9BQU8sS0FBSyxNQUFNLFdBQVcsQ0FBQztBQVE5QixNQUFNLE9BQU8sd0JBQXdCO0lBQ25DLFlBQ1UsSUFBZ0IsRUFDaEIsU0FBaUM7UUFEakMsU0FBSSxHQUFKLElBQUksQ0FBWTtRQUNoQixjQUFTLEdBQVQsU0FBUyxDQUF3QjtJQUN4QyxDQUFDO0lBRUcsY0FBYyxDQUFDLElBQVk7UUFDaEMsTUFBTSxRQUFRLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsUUFBUSxDQUFDLEVBQUU7WUFDN0MsTUFBTSxJQUFJLEdBQUcsUUFBUSxDQUFDLE1BQU0sR0FBRyxJQUFJLEdBQUcsUUFBUSxDQUFDLE1BQU0sQ0FBQztZQUN0RCxPQUFPLElBQUksQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDLEVBQUU7Z0JBQy9DLE9BQU8sQ0FBQyxLQUFLLENBQUMsMERBQTBELEVBQUUsSUFBSSxDQUFDLENBQUM7Z0JBQ2hGLE9BQU8sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO2dCQUMzQixPQUFPLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztZQUNoQixDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ04sQ0FBQyxDQUFDLENBQUM7UUFDSCxPQUFPLFFBQVEsQ0FBQyxRQUFRLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDdkUsQ0FBQztDQUNGIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtIdHRwQ2xpZW50fSBmcm9tIFwiQGFuZ3VsYXIvY29tbW9uL2h0dHBcIjtcclxuaW1wb3J0IHtUcmFuc2xhdGVMb2FkZXJ9IGZyb20gXCJAbmd4LXRyYW5zbGF0ZS9jb3JlXCI7XHJcbmltcG9ydCB7T2JzZXJ2YWJsZSwgZm9ya0pvaW4sIG9mfSBmcm9tIFwicnhqc1wiO1xyXG5pbXBvcnQge2NhdGNoRXJyb3IsIG1hcH0gZnJvbSBcInJ4anMvb3BlcmF0b3JzXCI7XHJcbmltcG9ydCBtZXJnZSBmcm9tICdkZWVwbWVyZ2UnO1xyXG5cclxuXHJcbmV4cG9ydCBpbnRlcmZhY2UgSVRyYW5zbGF0aW9uUmVzb3VyY2Uge1xyXG4gIHByZWZpeDogc3RyaW5nO1xyXG4gIHN1ZmZpeDogc3RyaW5nO1xyXG59XHJcblxyXG5leHBvcnQgY2xhc3MgTXVsdGlUcmFuc2xhdGVIdHRwTG9hZGVyIGltcGxlbWVudHMgVHJhbnNsYXRlTG9hZGVyIHtcclxuICBjb25zdHJ1Y3RvcihcclxuICAgIHByaXZhdGUgaHR0cDogSHR0cENsaWVudCxcclxuICAgIHByaXZhdGUgcmVzb3VyY2VzOiBJVHJhbnNsYXRpb25SZXNvdXJjZVtdLFxyXG4gICkge31cclxuXHJcbiAgcHVibGljIGdldFRyYW5zbGF0aW9uKGxhbmc6IHN0cmluZyk6IE9ic2VydmFibGU8YW55PiB7XHJcbiAgICBjb25zdCByZXF1ZXN0cyA9IHRoaXMucmVzb3VyY2VzLm1hcChyZXNvdXJjZSA9PiB7XHJcbiAgICAgIGNvbnN0IHBhdGggPSByZXNvdXJjZS5wcmVmaXggKyBsYW5nICsgcmVzb3VyY2Uuc3VmZml4O1xyXG4gICAgICByZXR1cm4gdGhpcy5odHRwLmdldChwYXRoKS5waXBlKGNhdGNoRXJyb3IocmVzID0+IHtcclxuICAgICAgICBjb25zb2xlLmVycm9yKFwiU29tZXRoaW5nIHdlbnQgd3JvbmcgZm9yIHRoZSBmb2xsb3dpbmcgdHJhbnNsYXRpb24gZmlsZTpcIiwgcGF0aCk7XHJcbiAgICAgICAgY29uc29sZS5lcnJvcihyZXMubWVzc2FnZSk7XHJcbiAgICAgICAgcmV0dXJuIG9mKHt9KTtcclxuICAgICAgfSkpO1xyXG4gICAgfSk7XHJcbiAgICByZXR1cm4gZm9ya0pvaW4ocmVxdWVzdHMpLnBpcGUobWFwKHJlc3BvbnNlID0+IG1lcmdlLmFsbChyZXNwb25zZSkpKTtcclxuICB9XHJcbn1cclxuIl19
|
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* Generated bundle index. Do not edit.
|
3
|
-
*/
|
4
|
-
export * from './index';
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
export * from './index';
|
5
5
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvbmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci9zcmMvbmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
|
@@ -2,28 +2,28 @@ import { of, forkJoin } from 'rxjs';
|
|
2
2
|
import { catchError, map } from 'rxjs/operators';
|
3
3
|
import merge from 'deepmerge';
|
4
4
|
|
5
|
-
class MultiTranslateHttpLoader {
|
6
|
-
constructor(http, resources) {
|
7
|
-
this.http = http;
|
8
|
-
this.resources = resources;
|
9
|
-
}
|
10
|
-
getTranslation(lang) {
|
11
|
-
const requests = this.resources.map(resource => {
|
12
|
-
const path = resource.prefix + lang + resource.suffix;
|
13
|
-
return this.http.get(path).pipe(catchError(res => {
|
14
|
-
console.error("Something went wrong for the following translation file:", path);
|
15
|
-
console.error(res.message);
|
16
|
-
return of({});
|
17
|
-
}));
|
18
|
-
});
|
19
|
-
return forkJoin(requests).pipe(map(response => merge.all(response)));
|
20
|
-
}
|
5
|
+
class MultiTranslateHttpLoader {
|
6
|
+
constructor(http, resources) {
|
7
|
+
this.http = http;
|
8
|
+
this.resources = resources;
|
9
|
+
}
|
10
|
+
getTranslation(lang) {
|
11
|
+
const requests = this.resources.map(resource => {
|
12
|
+
const path = resource.prefix + lang + resource.suffix;
|
13
|
+
return this.http.get(path).pipe(catchError(res => {
|
14
|
+
console.error("Something went wrong for the following translation file:", path);
|
15
|
+
console.error(res.message);
|
16
|
+
return of({});
|
17
|
+
}));
|
18
|
+
});
|
19
|
+
return forkJoin(requests).pipe(map(response => merge.all(response)));
|
20
|
+
}
|
21
21
|
}
|
22
22
|
|
23
23
|
// export * from './lib/ngx-translate-multi-http-loader.module';
|
24
24
|
|
25
|
-
/**
|
26
|
-
* Generated bundle index. Do not edit.
|
25
|
+
/**
|
26
|
+
* Generated bundle index. Do not edit.
|
27
27
|
*/
|
28
28
|
|
29
29
|
export { MultiTranslateHttpLoader };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ngx-translate-multi-http-loader.mjs","sources":["../../../../libs/ngx-translate-multi-http-loader/src/lib/multi-http-loader.ts","../../../../libs/ngx-translate-multi-http-loader/src/index.ts","../../../../libs/ngx-translate-multi-http-loader/src/ngx-translate-multi-http-loader.ts"],"sourcesContent":["import {HttpClient} from \"@angular/common/http\";\nimport {TranslateLoader} from \"@ngx-translate/core\";\nimport {Observable, forkJoin, of} from \"rxjs\";\nimport {catchError, map} from \"rxjs/operators\";\nimport merge from 'deepmerge';\n\n\nexport interface ITranslationResource {\n prefix: string;\n suffix: string;\n}\n\nexport class MultiTranslateHttpLoader implements TranslateLoader {\n constructor(\n private http: HttpClient,\n private resources: ITranslationResource[],\n ) {}\n\n public getTranslation(lang: string): Observable<any> {\n const requests = this.resources.map(resource => {\n const path = resource.prefix + lang + resource.suffix;\n return this.http.get(path).pipe(catchError(res => {\n console.error(\"Something went wrong for the following translation file:\", path);\n console.error(res.message);\n return of({});\n }));\n });\n return forkJoin(requests).pipe(map(response => merge.all(response)));\n }\n}\n","// export * from './lib/ngx-translate-multi-http-loader.module';\nexport * from './lib/multi-http-loader';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAYa,wBAAwB;IACnC,YACU,IAAgB,EAChB,SAAiC;QADjC,SAAI,GAAJ,IAAI,CAAY;QAChB,cAAS,GAAT,SAAS,CAAwB;KACvC;IAEG,cAAc,CAAC,IAAY;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ;YAC1C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;YACtD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG;gBAC5C,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,IAAI,CAAC,CAAC;gBAChF,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC3B,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;aACf,CAAC,CAAC,CAAC;SACL,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KACtE;;;AC5BH;;ACAA;;;;;;"}
|
1
|
+
{"version":3,"file":"ngx-translate-multi-http-loader.mjs","sources":["../../../../libs/ngx-translate-multi-http-loader/src/lib/multi-http-loader.ts","../../../../libs/ngx-translate-multi-http-loader/src/index.ts","../../../../libs/ngx-translate-multi-http-loader/src/ngx-translate-multi-http-loader.ts"],"sourcesContent":["import {HttpClient} from \"@angular/common/http\";\r\nimport {TranslateLoader} from \"@ngx-translate/core\";\r\nimport {Observable, forkJoin, of} from \"rxjs\";\r\nimport {catchError, map} from \"rxjs/operators\";\r\nimport merge from 'deepmerge';\r\n\r\n\r\nexport interface ITranslationResource {\r\n prefix: string;\r\n suffix: string;\r\n}\r\n\r\nexport class MultiTranslateHttpLoader implements TranslateLoader {\r\n constructor(\r\n private http: HttpClient,\r\n private resources: ITranslationResource[],\r\n ) {}\r\n\r\n public getTranslation(lang: string): Observable<any> {\r\n const requests = this.resources.map(resource => {\r\n const path = resource.prefix + lang + resource.suffix;\r\n return this.http.get(path).pipe(catchError(res => {\r\n console.error(\"Something went wrong for the following translation file:\", path);\r\n console.error(res.message);\r\n return of({});\r\n }));\r\n });\r\n return forkJoin(requests).pipe(map(response => merge.all(response)));\r\n }\r\n}\r\n","// export * from './lib/ngx-translate-multi-http-loader.module';\r\nexport * from './lib/multi-http-loader';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAYa,wBAAwB;IACnC,YACU,IAAgB,EAChB,SAAiC;QADjC,SAAI,GAAJ,IAAI,CAAY;QAChB,cAAS,GAAT,SAAS,CAAwB;KACvC;IAEG,cAAc,CAAC,IAAY;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ;YAC1C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;YACtD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG;gBAC5C,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,IAAI,CAAC,CAAC;gBAChF,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC3B,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;aACf,CAAC,CAAC,CAAC;SACL,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KACtE;;;AC5BH;;ACAA;;;;;;"}
|
@@ -2,28 +2,28 @@ import { of, forkJoin } from 'rxjs';
|
|
2
2
|
import { catchError, map } from 'rxjs/operators';
|
3
3
|
import merge from 'deepmerge';
|
4
4
|
|
5
|
-
class MultiTranslateHttpLoader {
|
6
|
-
constructor(http, resources) {
|
7
|
-
this.http = http;
|
8
|
-
this.resources = resources;
|
9
|
-
}
|
10
|
-
getTranslation(lang) {
|
11
|
-
const requests = this.resources.map(resource => {
|
12
|
-
const path = resource.prefix + lang + resource.suffix;
|
13
|
-
return this.http.get(path).pipe(catchError(res => {
|
14
|
-
console.error("Something went wrong for the following translation file:", path);
|
15
|
-
console.error(res.message);
|
16
|
-
return of({});
|
17
|
-
}));
|
18
|
-
});
|
19
|
-
return forkJoin(requests).pipe(map(response => merge.all(response)));
|
20
|
-
}
|
5
|
+
class MultiTranslateHttpLoader {
|
6
|
+
constructor(http, resources) {
|
7
|
+
this.http = http;
|
8
|
+
this.resources = resources;
|
9
|
+
}
|
10
|
+
getTranslation(lang) {
|
11
|
+
const requests = this.resources.map(resource => {
|
12
|
+
const path = resource.prefix + lang + resource.suffix;
|
13
|
+
return this.http.get(path).pipe(catchError(res => {
|
14
|
+
console.error("Something went wrong for the following translation file:", path);
|
15
|
+
console.error(res.message);
|
16
|
+
return of({});
|
17
|
+
}));
|
18
|
+
});
|
19
|
+
return forkJoin(requests).pipe(map(response => merge.all(response)));
|
20
|
+
}
|
21
21
|
}
|
22
22
|
|
23
23
|
// export * from './lib/ngx-translate-multi-http-loader.module';
|
24
24
|
|
25
|
-
/**
|
26
|
-
* Generated bundle index. Do not edit.
|
25
|
+
/**
|
26
|
+
* Generated bundle index. Do not edit.
|
27
27
|
*/
|
28
28
|
|
29
29
|
export { MultiTranslateHttpLoader };
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ngx-translate-multi-http-loader.mjs","sources":["../../../../libs/ngx-translate-multi-http-loader/src/lib/multi-http-loader.ts","../../../../libs/ngx-translate-multi-http-loader/src/index.ts","../../../../libs/ngx-translate-multi-http-loader/src/ngx-translate-multi-http-loader.ts"],"sourcesContent":["import {HttpClient} from \"@angular/common/http\";\nimport {TranslateLoader} from \"@ngx-translate/core\";\nimport {Observable, forkJoin, of} from \"rxjs\";\nimport {catchError, map} from \"rxjs/operators\";\nimport merge from 'deepmerge';\n\n\nexport interface ITranslationResource {\n prefix: string;\n suffix: string;\n}\n\nexport class MultiTranslateHttpLoader implements TranslateLoader {\n constructor(\n private http: HttpClient,\n private resources: ITranslationResource[],\n ) {}\n\n public getTranslation(lang: string): Observable<any> {\n const requests = this.resources.map(resource => {\n const path = resource.prefix + lang + resource.suffix;\n return this.http.get(path).pipe(catchError(res => {\n console.error(\"Something went wrong for the following translation file:\", path);\n console.error(res.message);\n return of({});\n }));\n });\n return forkJoin(requests).pipe(map(response => merge.all(response)));\n }\n}\n","// export * from './lib/ngx-translate-multi-http-loader.module';\nexport * from './lib/multi-http-loader';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAYa,wBAAwB;IACnC,YACU,IAAgB,EAChB,SAAiC;QADjC,SAAI,GAAJ,IAAI,CAAY;QAChB,cAAS,GAAT,SAAS,CAAwB;KACvC;IAEG,cAAc,CAAC,IAAY;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ;YAC1C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;YACtD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG;gBAC5C,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,IAAI,CAAC,CAAC;gBAChF,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC3B,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;aACf,CAAC,CAAC,CAAC;SACL,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KACtE;;;AC5BH;;ACAA;;;;;;"}
|
1
|
+
{"version":3,"file":"ngx-translate-multi-http-loader.mjs","sources":["../../../../libs/ngx-translate-multi-http-loader/src/lib/multi-http-loader.ts","../../../../libs/ngx-translate-multi-http-loader/src/index.ts","../../../../libs/ngx-translate-multi-http-loader/src/ngx-translate-multi-http-loader.ts"],"sourcesContent":["import {HttpClient} from \"@angular/common/http\";\r\nimport {TranslateLoader} from \"@ngx-translate/core\";\r\nimport {Observable, forkJoin, of} from \"rxjs\";\r\nimport {catchError, map} from \"rxjs/operators\";\r\nimport merge from 'deepmerge';\r\n\r\n\r\nexport interface ITranslationResource {\r\n prefix: string;\r\n suffix: string;\r\n}\r\n\r\nexport class MultiTranslateHttpLoader implements TranslateLoader {\r\n constructor(\r\n private http: HttpClient,\r\n private resources: ITranslationResource[],\r\n ) {}\r\n\r\n public getTranslation(lang: string): Observable<any> {\r\n const requests = this.resources.map(resource => {\r\n const path = resource.prefix + lang + resource.suffix;\r\n return this.http.get(path).pipe(catchError(res => {\r\n console.error(\"Something went wrong for the following translation file:\", path);\r\n console.error(res.message);\r\n return of({});\r\n }));\r\n });\r\n return forkJoin(requests).pipe(map(response => merge.all(response)));\r\n }\r\n}\r\n","// export * from './lib/ngx-translate-multi-http-loader.module';\r\nexport * from './lib/multi-http-loader';\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAYa,wBAAwB;IACnC,YACU,IAAgB,EAChB,SAAiC;QADjC,SAAI,GAAJ,IAAI,CAAY;QAChB,cAAS,GAAT,SAAS,CAAwB;KACvC;IAEG,cAAc,CAAC,IAAY;QAChC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ;YAC1C,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC;YACtD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG;gBAC5C,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,IAAI,CAAC,CAAC;gBAChF,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBAC3B,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;aACf,CAAC,CAAC,CAAC;SACL,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;KACtE;;;AC5BH;;ACAA;;;;;;"}
|
package/index.d.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export * from './lib/multi-http-loader';
|
1
|
+
export * from './lib/multi-http-loader';
|
@@ -1,13 +1,13 @@
|
|
1
|
-
import { HttpClient } from "@angular/common/http";
|
2
|
-
import { TranslateLoader } from "@ngx-translate/core";
|
3
|
-
import { Observable } from "rxjs";
|
4
|
-
export interface ITranslationResource {
|
5
|
-
prefix: string;
|
6
|
-
suffix: string;
|
7
|
-
}
|
8
|
-
export declare class MultiTranslateHttpLoader implements TranslateLoader {
|
9
|
-
private http;
|
10
|
-
private resources;
|
11
|
-
constructor(http: HttpClient, resources: ITranslationResource[]);
|
12
|
-
getTranslation(lang: string): Observable<any>;
|
13
|
-
}
|
1
|
+
import { HttpClient } from "@angular/common/http";
|
2
|
+
import { TranslateLoader } from "@ngx-translate/core";
|
3
|
+
import { Observable } from "rxjs";
|
4
|
+
export interface ITranslationResource {
|
5
|
+
prefix: string;
|
6
|
+
suffix: string;
|
7
|
+
}
|
8
|
+
export declare class MultiTranslateHttpLoader implements TranslateLoader {
|
9
|
+
private http;
|
10
|
+
private resources;
|
11
|
+
constructor(http: HttpClient, resources: ITranslationResource[]);
|
12
|
+
getTranslation(lang: string): Observable<any>;
|
13
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* Generated bundle index. Do not edit.
|
3
|
-
*/
|
4
|
-
/// <amd-module name="ngx-translate-multi-http-loader" />
|
5
|
-
export * from './index';
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
/// <amd-module name="ngx-translate-multi-http-loader" />
|
5
|
+
export * from './index';
|