ngx-translate-multi-http-loader 7.0.5 → 8.0.0

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 CHANGED
@@ -1,7 +1,89 @@
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 [![npm version](https://badge.fury.io/js/ngx-translate-multi-http-loader.svg)](https://badge.fury.io/js/ngx-translate-multi-http-loader)
2
+
3
+ A loader for [ngx-translate](https://github.com/ngx-translate/core) that loads translations using http.
4
+
5
+ Angular 6 example: https://stackblitz.com/edit/ngx-translate-multi-http-loader-sample
6
+
7
+ Angular 13 example: https://github.com/denniske/ngx-translate-multi-http-loader-demo
8
+
9
+ Get the complete changelog here: https://github.com/denniske/ngx-translate-multi-http-loader/releases
10
+
11
+ * [Installation](#installation)
12
+ * [Usage](#usage)
13
+
14
+ ## Installation
15
+
16
+ We assume that you already installed [ngx-translate](https://github.com/ngx-translate/core).
17
+
18
+ Now you need to install the npm module for `MultiTranslateHttpLoader`:
19
+
20
+ ```sh
21
+ npm install ngx-translate-multi-http-loader --save
22
+ ```
23
+
24
+ Choose the version corresponding to your Angular version:
25
+
26
+ Angular | @ngx-translate/core | ngx-translate-multi-http-loader
27
+ ----------- |---------------------| --------------------------
28
+ 13 | 14.x+ | 7.x+
29
+ 6 | 10.x+ | 1.x+
30
+
31
+ ## Usage
32
+ #### 1. Setup the `TranslateModule` to use the `MultiTranslateHttpLoader`:
33
+
34
+ The `MultiTranslateHttpLoader` uses HttpClient to load translations, which means that you have to import the HttpClientModule from `@angular/common/http` before the `TranslateModule`:
35
+
36
+
37
+ ```ts
38
+ import {NgModule} from '@angular/core';
39
+ import {BrowserModule} from '@angular/platform-browser';
40
+ import {HttpClientModule, HttpClient} from '@angular/common/http';
41
+ import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
42
+ import {MultiTranslateHttpLoader} from "ngx-translate-multi-http-loader";
43
+ import {AppComponent} from "./app";
44
+
45
+ // AoT requires an exported function for factories
46
+ export function HttpLoaderFactory(http: HttpClient) {
47
+ return new MultiTranslateHttpLoader(http, [
48
+ {prefix: "./assets/translate/core/", suffix: ".json"},
49
+ {prefix: "./assets/translate/shared/", suffix: ".json"},
50
+ ]);
51
+ }
52
+
53
+ @NgModule({
54
+ imports: [
55
+ BrowserModule,
56
+ HttpClientModule,
57
+ TranslateModule.forRoot({
58
+ loader: {
59
+ provide: TranslateLoader,
60
+ useFactory: HttpLoaderFactory,
61
+ deps: [HttpClient]
62
+ }
63
+ })
64
+ ],
65
+ bootstrap: [AppComponent]
66
+ })
67
+ export class AppModule { }
68
+ ```
69
+
70
+ The `MultiTranslateHttpLoader` takes a list of translation file configurations. Each configuration has two optional parameters:
71
+ - prefix: string = "/assets/translate/"
72
+ - suffix: string = ".json"
73
+
74
+ By using those default parameters, it will load your translations files for the lang "en" from: `/assets/translate/en.json`.
75
+
76
+ You can change those in the `HttpLoaderFactory` method that we just defined. For example if you want to load the "en" translations from `/assets/translate/core/en.json` and `/assets/translate/shared/en.json` you would use:
77
+
78
+ ```ts
79
+ export function HttpLoaderFactory(http: HttpClient) {
80
+ return new MultiTranslateHttpLoader(http, [
81
+ {prefix: "./assets/translate/core/", suffix: ".json"},
82
+ {prefix: "./assets/translate/shared/", suffix: ".json"},
83
+ ]);
84
+ }
85
+ ```
86
+
87
+ For now this loader only support the json format.
88
+
89
+ The loader will merge all translation files from the server using [deepmerge](https://github.com/KyleAMathews/deepmerge).
@@ -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,30 +1,21 @@
1
- import { of, forkJoin } from 'rxjs';
2
- import { catchError, map } from 'rxjs/operators';
1
+ import { forkJoin, of } from "rxjs";
2
+ import { catchError, map } from "rxjs/operators";
3
+ // @ts-ignore
3
4
  import merge from 'deepmerge';
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
+ export 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
-
23
- // export * from './lib/ngx-translate-multi-http-loader.module';
24
-
25
- /**
26
- * Generated bundle index. Do not edit.
27
- */
28
-
29
- export { MultiTranslateHttpLoader };
30
- //# sourceMappingURL=ngx-translate-multi-http-loader.mjs.map
package/package.json CHANGED
@@ -1,38 +1,27 @@
1
1
  {
2
2
  "name": "ngx-translate-multi-http-loader",
3
- "version": "7.0.5",
4
- "license": "MIT",
3
+ "version": "8.0.0",
5
4
  "maintainers": [
6
5
  "denniske.npm@gmail.com"
7
6
  ],
8
7
  "peerDependencies": {
9
8
  "@angular/common": "^13.0.0",
10
- "@angular/core": "^13.0.0",
11
- "@ngx-translate/core": ">=14.0.0",
12
- "rxjs": "^7.4.0"
9
+ "@angular/core": "^13.0.0"
13
10
  },
14
11
  "dependencies": {
15
- "tslib": "^2.3.0",
16
- "deepmerge": ">=4.2.2"
12
+ "@angular/common": ">=14.0.0",
13
+ "@angular/core": ">=14.0.0",
14
+ "@ngx-translate/core": ">=14.0.0",
15
+ "deepmerge": ">=4.2.2",
16
+ "rxjs": ">=7.4.0",
17
+ "tslib": ">=2.0.0"
17
18
  },
18
- "module": "fesm2015/ngx-translate-multi-http-loader.mjs",
19
- "es2020": "fesm2020/ngx-translate-multi-http-loader.mjs",
20
- "esm2020": "esm2020/ngx-translate-multi-http-loader.mjs",
21
- "fesm2020": "fesm2020/ngx-translate-multi-http-loader.mjs",
22
- "fesm2015": "fesm2015/ngx-translate-multi-http-loader.mjs",
23
- "typings": "ngx-translate-multi-http-loader.d.ts",
24
- "exports": {
25
- "./package.json": {
26
- "default": "./package.json"
27
- },
28
- ".": {
29
- "types": "./ngx-translate-multi-http-loader.d.ts",
30
- "esm2020": "./esm2020/ngx-translate-multi-http-loader.mjs",
31
- "es2020": "./fesm2020/ngx-translate-multi-http-loader.mjs",
32
- "es2015": "./fesm2015/ngx-translate-multi-http-loader.mjs",
33
- "node": "./fesm2015/ngx-translate-multi-http-loader.mjs",
34
- "default": "./fesm2020/ngx-translate-multi-http-loader.mjs"
35
- }
19
+ "devDependencies": {
20
+ "typescript": ">=4.4.3"
36
21
  },
37
- "sideEffects": false
22
+ "main": "dist/index.js",
23
+ "types": "dist/index.d.ts",
24
+ "files": [
25
+ "/dist"
26
+ ]
38
27
  }
package/esm2020/index.mjs DELETED
@@ -1,3 +0,0 @@
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 +0,0 @@
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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXVsdGktaHR0cC1sb2FkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL25neC10cmFuc2xhdGUtbXVsdGktaHR0cC1sb2FkZXIvc3JjL2xpYi9tdWx0aS1odHRwLWxvYWRlci50cyJdL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4O1xyXG4gICAgICByZXR1cm4gdGhpcy5odHRwLmdldChwYXRoKS5waXBlKGNhdGNoRXJyb3IocmVzID0+IHtcclxuICAgICAgICBjb25zb2xlLmVycm9yKFwiU29tZXRoaW5nIHdlbnQgd3JvbmcgZm9yIHRoZSBmb2xsb3dpbmcgdHJhbnNsYXRpb24gZmlsZTpcIiwgcGF0aCk7XHJcbiAgICAgICAgY29uc29sZS5lcnJvcihyZXMubWVzc2FnZSk7XHJcbiAgICAgICAgcmV0dXJuIG9mKHt9KTtcclxuICAgICAgfSkpO1xyXG4gICAgfSk7XHJcbiAgICByZXR1cm4gZm9ya0pvaW4ocmVxdWVzdHMpLnBpcGUobWFwKHJlc3BvbnNlID0+IG1lcmdlLmFsbChyZXNwb25zZSkpKTtcclxuICB9XHJcbn1cclxuIl19
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './index';
5
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvbmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci9zcmMvbmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
@@ -1,30 +0,0 @@
1
- import { of, forkJoin } from 'rxjs';
2
- import { catchError, map } from 'rxjs/operators';
3
- import merge from 'deepmerge';
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
- }
21
- }
22
-
23
- // export * from './lib/ngx-translate-multi-http-loader.module';
24
-
25
- /**
26
- * Generated bundle index. Do not edit.
27
- */
28
-
29
- export { MultiTranslateHttpLoader };
30
- //# sourceMappingURL=ngx-translate-multi-http-loader.mjs.map
@@ -1 +0,0 @@
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;;;;;;"}
@@ -1 +0,0 @@
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 DELETED
@@ -1 +0,0 @@
1
- export * from './lib/multi-http-loader';
@@ -1,5 +0,0 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- /// <amd-module name="ngx-translate-multi-http-loader" />
5
- export * from './index';