ngx-translate-multi-http-loader 2.1.0 → 7.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 +4 -83
- package/esm2020/index.mjs +3 -0
- package/esm2020/lib/multi-http-loader.mjs +21 -0
- package/esm2020/ngx-translate-multi-http-loader.mjs +5 -0
- package/fesm2015/ngx-translate-multi-http-loader.mjs +30 -0
- package/fesm2015/ngx-translate-multi-http-loader.mjs.map +1 -0
- package/fesm2020/ngx-translate-multi-http-loader.mjs +30 -0
- package/fesm2020/ngx-translate-multi-http-loader.mjs.map +1 -0
- package/index.d.ts +1 -0
- package/ngx-translate-multi-http-loader.d.ts +2 -1
- package/package.json +37 -1
- package/bundles/ngx-translate-multi-http-loader.umd.js +0 -41
- package/bundles/ngx-translate-multi-http-loader.umd.js.map +0 -12
- package/bundles/ngx-translate-multi-http-loader.umd.min.js +0 -2
- package/bundles/ngx-translate-multi-http-loader.umd.min.js.map +0 -27
- package/esm2015/lib/multi-http-loader.js +0 -44
- package/esm2015/lib/multi-http-loader.js.map +0 -12
- package/esm2015/ngx-translate-multi-http-loader.js +0 -9
- package/esm2015/ngx-translate-multi-http-loader.js.map +0 -12
- package/esm2015/public_api.js +0 -6
- package/esm2015/public_api.js.map +0 -12
- package/esm5/lib/multi-http-loader.js +0 -47
- package/esm5/lib/multi-http-loader.js.map +0 -12
- package/esm5/ngx-translate-multi-http-loader.js +0 -9
- package/esm5/ngx-translate-multi-http-loader.js.map +0 -12
- package/esm5/public_api.js +0 -6
- package/esm5/public_api.js.map +0 -12
- package/fesm2015/ngx-translate-multi-http-loader.js +0 -41
- package/fesm2015/ngx-translate-multi-http-loader.js.map +0 -12
- package/fesm5/ngx-translate-multi-http-loader.js +0 -43
- package/fesm5/ngx-translate-multi-http-loader.js.map +0 -12
- package/ngx-translate-multi-http-loader.metadata.json +0 -1
- package/public_api.d.ts +0 -1
package/README.md
CHANGED
@@ -1,86 +1,7 @@
|
|
1
|
-
#
|
1
|
+
# ngx-translate-multi-http-loader
|
2
2
|
|
3
|
-
|
3
|
+
This library was generated with [Nx](https://nx.dev).
|
4
4
|
|
5
|
-
|
5
|
+
## Running unit tests
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
* [Installation](#installation)
|
10
|
-
* [Usage](#usage)
|
11
|
-
|
12
|
-
## Installation
|
13
|
-
|
14
|
-
We assume that you already installed [ngx-translate](https://github.com/ngx-translate/core).
|
15
|
-
|
16
|
-
Now you need to install the npm module for `MultiTranslateHttpLoader`:
|
17
|
-
|
18
|
-
```sh
|
19
|
-
npm install ngx-translate-multi-http-loader --save
|
20
|
-
```
|
21
|
-
|
22
|
-
Choose the version corresponding to your Angular version:
|
23
|
-
|
24
|
-
Angular | @ngx-translate/core | ngx-translate-multi-http-loader
|
25
|
-
----------- | ------------------- | --------------------------
|
26
|
-
6 | 10.x+ | 1.x+
|
27
|
-
|
28
|
-
## Usage
|
29
|
-
#### 1. Setup the `TranslateModule` to use the `MultiTranslateHttpLoader`:
|
30
|
-
|
31
|
-
The `MultiTranslateHttpLoader` uses HttpClient to load translations, which means that you have to import the HttpClientModule from `@angular/common/http` before the `TranslateModule`:
|
32
|
-
|
33
|
-
|
34
|
-
```ts
|
35
|
-
import {NgModule} from '@angular/core';
|
36
|
-
import {BrowserModule} from '@angular/platform-browser';
|
37
|
-
import {HttpClientModule, HttpClient} from '@angular/common/http';
|
38
|
-
import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
|
39
|
-
import {MultiTranslateHttpLoader} from "ngx-translate-multi-http-loader";
|
40
|
-
import {AppComponent} from "./app";
|
41
|
-
|
42
|
-
// AoT requires an exported function for factories
|
43
|
-
export function HttpLoaderFactory(http: HttpClient) {
|
44
|
-
return new MultiTranslateHttpLoader(http, [
|
45
|
-
{prefix: "./assets/translate/core/", suffix: ".json"},
|
46
|
-
{prefix: "./assets/translate/shared/", suffix: ".json"},
|
47
|
-
]);
|
48
|
-
}
|
49
|
-
|
50
|
-
@NgModule({
|
51
|
-
imports: [
|
52
|
-
BrowserModule,
|
53
|
-
HttpClientModule,
|
54
|
-
TranslateModule.forRoot({
|
55
|
-
loader: {
|
56
|
-
provide: TranslateLoader,
|
57
|
-
useFactory: HttpLoaderFactory,
|
58
|
-
deps: [HttpClient]
|
59
|
-
}
|
60
|
-
})
|
61
|
-
],
|
62
|
-
bootstrap: [AppComponent]
|
63
|
-
})
|
64
|
-
export class AppModule { }
|
65
|
-
```
|
66
|
-
|
67
|
-
The `MultiTranslateHttpLoader` takes a list of translation file configurations. Each configuration has two optional parameters:
|
68
|
-
- prefix: string = "/assets/translate/"
|
69
|
-
- suffix: string = ".json"
|
70
|
-
|
71
|
-
By using those default parameters, it will load your translations files for the lang "en" from: `/assets/translate/en.json`.
|
72
|
-
|
73
|
-
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:
|
74
|
-
|
75
|
-
```ts
|
76
|
-
export function HttpLoaderFactory(http: HttpClient) {
|
77
|
-
return new MultiTranslateHttpLoader(http, [
|
78
|
-
{prefix: "./assets/translate/core/", suffix: ".json"},
|
79
|
-
{prefix: "./assets/translate/shared/", suffix: ".json"},
|
80
|
-
]);
|
81
|
-
}
|
82
|
-
```
|
83
|
-
|
84
|
-
For now this loader only support the json format.
|
85
|
-
|
86
|
-
The loader will merge all translation files from the server using [deepmerge](https://github.com/KyleAMathews/deepmerge).
|
7
|
+
Run `nx test ngx-translate-multi-http-loader` to execute the unit tests.
|
@@ -0,0 +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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9saWJzL25neC10cmFuc2xhdGUtbXVsdGktaHR0cC1sb2FkZXIvc3JjL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGdFQUFnRTtBQUNoRSxjQUFjLHlCQUF5QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLy8gZXhwb3J0ICogZnJvbSAnLi9saWIvbmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci5tb2R1bGUnO1xuZXhwb3J0ICogZnJvbSAnLi9saWIvbXVsdGktaHR0cC1sb2FkZXInO1xuIl19
|
@@ -0,0 +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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXVsdGktaHR0cC1sb2FkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzL25neC10cmFuc2xhdGUtbXVsdGktaHR0cC1sb2FkZXIvc3JjL2xpYi9tdWx0aS1odHRwLWxvYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFQSxPQUFPLEVBQWEsUUFBUSxFQUFFLEVBQUUsRUFBQyxNQUFNLE1BQU0sQ0FBQztBQUM5QyxPQUFPLEVBQUMsVUFBVSxFQUFFLEdBQUcsRUFBQyxNQUFNLGdCQUFnQixDQUFDO0FBQy9DLE9BQU8sS0FBSyxNQUFNLFdBQVcsQ0FBQztBQVE5QixNQUFNLE9BQU8sd0JBQXdCO0lBQ25DLFlBQ1UsSUFBZ0IsRUFDaEIsU0FBaUM7UUFEakMsU0FBSSxHQUFKLElBQUksQ0FBWTtRQUNoQixjQUFTLEdBQVQsU0FBUyxDQUF3QjtJQUN4QyxDQUFDO0lBRUcsY0FBYyxDQUFDLElBQVk7UUFDaEMsTUFBTSxRQUFRLEdBQUcsSUFBSSxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsUUFBUSxDQUFDLEVBQUU7WUFDN0MsTUFBTSxJQUFJLEdBQUcsUUFBUSxDQUFDLE1BQU0sR0FBRyxJQUFJLEdBQUcsUUFBUSxDQUFDLE1BQU0sQ0FBQztZQUN0RCxPQUFPLElBQUksQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDLElBQUksQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDLEVBQUU7Z0JBQy9DLE9BQU8sQ0FBQyxLQUFLLENBQUMsMERBQTBELEVBQUUsSUFBSSxDQUFDLENBQUM7Z0JBQ2hGLE9BQU8sQ0FBQyxLQUFLLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO2dCQUMzQixPQUFPLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQztZQUNoQixDQUFDLENBQUMsQ0FBQyxDQUFDO1FBQ04sQ0FBQyxDQUFDLENBQUM7UUFDSCxPQUFPLFFBQVEsQ0FBQyxRQUFRLENBQUMsQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDdkUsQ0FBQztDQUNGIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHtIdHRwQ2xpZW50fSBmcm9tIFwiQGFuZ3VsYXIvY29tbW9uL2h0dHBcIjtcbmltcG9ydCB7VHJhbnNsYXRlTG9hZGVyfSBmcm9tIFwiQG5neC10cmFuc2xhdGUvY29yZVwiO1xuaW1wb3J0IHtPYnNlcnZhYmxlLCBmb3JrSm9pbiwgb2Z9IGZyb20gXCJyeGpzXCI7XG5pbXBvcnQge2NhdGNoRXJyb3IsIG1hcH0gZnJvbSBcInJ4anMvb3BlcmF0b3JzXCI7XG5pbXBvcnQgbWVyZ2UgZnJvbSAnZGVlcG1lcmdlJztcblxuXG5leHBvcnQgaW50ZXJmYWNlIElUcmFuc2xhdGlvblJlc291cmNlIHtcbiAgcHJlZml4OiBzdHJpbmc7XG4gIHN1ZmZpeDogc3RyaW5nO1xufVxuXG5leHBvcnQgY2xhc3MgTXVsdGlUcmFuc2xhdGVIdHRwTG9hZGVyIGltcGxlbWVudHMgVHJhbnNsYXRlTG9hZGVyIHtcbiAgY29uc3RydWN0b3IoXG4gICAgcHJpdmF0ZSBodHRwOiBIdHRwQ2xpZW50LFxuICAgIHByaXZhdGUgcmVzb3VyY2VzOiBJVHJhbnNsYXRpb25SZXNvdXJjZVtdLFxuICApIHt9XG5cbiAgcHVibGljIGdldFRyYW5zbGF0aW9uKGxhbmc6IHN0cmluZyk6IE9ic2VydmFibGU8YW55PiB7XG4gICAgY29uc3QgcmVxdWVzdHMgPSB0aGlzLnJlc291cmNlcy5tYXAocmVzb3VyY2UgPT4ge1xuICAgICAgY29uc3QgcGF0aCA9IHJlc291cmNlLnByZWZpeCArIGxhbmcgKyByZXNvdXJjZS5zdWZmaXg7XG4gICAgICByZXR1cm4gdGhpcy5odHRwLmdldChwYXRoKS5waXBlKGNhdGNoRXJyb3IocmVzID0+IHtcbiAgICAgICAgY29uc29sZS5lcnJvcihcIlNvbWV0aGluZyB3ZW50IHdyb25nIGZvciB0aGUgZm9sbG93aW5nIHRyYW5zbGF0aW9uIGZpbGU6XCIsIHBhdGgpO1xuICAgICAgICBjb25zb2xlLmVycm9yKHJlcy5tZXNzYWdlKTtcbiAgICAgICAgcmV0dXJuIG9mKHt9KTtcbiAgICAgIH0pKTtcbiAgICB9KTtcbiAgICByZXR1cm4gZm9ya0pvaW4ocmVxdWVzdHMpLnBpcGUobWFwKHJlc3BvbnNlID0+IG1lcmdlLmFsbChyZXNwb25zZSkpKTtcbiAgfVxufVxuIl19
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
export * from './index';
|
5
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL2xpYnMvbmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci9zcmMvbmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQTs7R0FFRztBQUVILGNBQWMsU0FBUyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBHZW5lcmF0ZWQgYnVuZGxlIGluZGV4LiBEbyBub3QgZWRpdC5cbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2luZGV4JztcbiJdfQ==
|
@@ -0,0 +1,30 @@
|
|
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
|
@@ -0,0 +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;;;;;;"}
|
@@ -0,0 +1,30 @@
|
|
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
|
@@ -0,0 +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;;;;;;"}
|
package/index.d.ts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export * from './lib/multi-http-loader';
|
package/package.json
CHANGED
@@ -1 +1,37 @@
|
|
1
|
-
{
|
1
|
+
{
|
2
|
+
"name": "ngx-translate-multi-http-loader",
|
3
|
+
"version": "7.0.0",
|
4
|
+
"maintainers": [
|
5
|
+
"denniske.npm@gmail.com"
|
6
|
+
],
|
7
|
+
"peerDependencies": {
|
8
|
+
"@angular/common": "^13.0.0",
|
9
|
+
"@angular/core": "^13.0.0",
|
10
|
+
"@ngx-translate/core": ">=14.0.0",
|
11
|
+
"rxjs": "~7.4.0",
|
12
|
+
"deepmerge": ">=4.2.2"
|
13
|
+
},
|
14
|
+
"dependencies": {
|
15
|
+
"tslib": "^2.3.0"
|
16
|
+
},
|
17
|
+
"module": "fesm2015/ngx-translate-multi-http-loader.mjs",
|
18
|
+
"es2020": "fesm2020/ngx-translate-multi-http-loader.mjs",
|
19
|
+
"esm2020": "esm2020/ngx-translate-multi-http-loader.mjs",
|
20
|
+
"fesm2020": "fesm2020/ngx-translate-multi-http-loader.mjs",
|
21
|
+
"fesm2015": "fesm2015/ngx-translate-multi-http-loader.mjs",
|
22
|
+
"typings": "ngx-translate-multi-http-loader.d.ts",
|
23
|
+
"exports": {
|
24
|
+
"./package.json": {
|
25
|
+
"default": "./package.json"
|
26
|
+
},
|
27
|
+
".": {
|
28
|
+
"types": "./ngx-translate-multi-http-loader.d.ts",
|
29
|
+
"esm2020": "./esm2020/ngx-translate-multi-http-loader.mjs",
|
30
|
+
"es2020": "./fesm2020/ngx-translate-multi-http-loader.mjs",
|
31
|
+
"es2015": "./fesm2015/ngx-translate-multi-http-loader.mjs",
|
32
|
+
"node": "./fesm2015/ngx-translate-multi-http-loader.mjs",
|
33
|
+
"default": "./fesm2020/ngx-translate-multi-http-loader.mjs"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"sideEffects": false
|
37
|
+
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
(function (global, factory) {
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('rxjs'), require('rxjs/operators'), require('deepmerge')) :
|
3
|
-
typeof define === 'function' && define.amd ? define('ngx-translate-multi-http-loader', ['exports', 'rxjs', 'rxjs/operators', 'deepmerge'], factory) :
|
4
|
-
(factory((global['ngx-translate-multi-http-loader'] = {}),null,global.Rx.Observable.prototype,null));
|
5
|
-
}(this, (function (exports,rxjs,operators,merge) { 'use strict';
|
6
|
-
|
7
|
-
merge = merge && merge.hasOwnProperty('default') ? merge['default'] : merge;
|
8
|
-
|
9
|
-
/**
|
10
|
-
* @fileoverview added by tsickle
|
11
|
-
* @suppress {checkTypes} checked by tsc
|
12
|
-
*/
|
13
|
-
var MultiTranslateHttpLoader = (function () {
|
14
|
-
/**
|
15
|
-
* @param {?} http
|
16
|
-
* @param {?} resources
|
17
|
-
*/
|
18
|
-
function MultiTranslateHttpLoader(http, resources) {
|
19
|
-
this.http = http;
|
20
|
-
this.resources = resources;
|
21
|
-
}
|
22
|
-
/**
|
23
|
-
* @param {?} lang
|
24
|
-
* @return {?}
|
25
|
-
*/
|
26
|
-
MultiTranslateHttpLoader.prototype.getTranslation = function (lang) {
|
27
|
-
var _this = this;
|
28
|
-
var /** @type {?} */ requests = this.resources.map(function (resource) {
|
29
|
-
return _this.http.get(resource.prefix + lang + resource.suffix);
|
30
|
-
});
|
31
|
-
return rxjs.forkJoin(requests).pipe(operators.map(function (response) { return merge.all(response); }));
|
32
|
-
};
|
33
|
-
return MultiTranslateHttpLoader;
|
34
|
-
}());
|
35
|
-
|
36
|
-
exports.MultiTranslateHttpLoader = MultiTranslateHttpLoader;
|
37
|
-
|
38
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
39
|
-
|
40
|
-
})));
|
41
|
-
//# sourceMappingURL=ngx-translate-multi-http-loader.umd.js.map
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "ngx-translate-multi-http-loader.umd.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/lib/multi-http-loader.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"import {HttpClient} from \"@angular/common/http\";\nimport {TranslateLoader} from \"@ngx-translate/core\";\nimport {Observable, forkJoin} from \"rxjs\";\nimport {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 return this.http.get(resource.prefix + lang + resource.suffix);\n });\n return forkJoin(requests).pipe(map(response => merge.all(response)));\n }\n}\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;;;;;;;;;AAEA,QAUA,wBAAA,IAAA;;;;;QACE,kCAAF,IAAA,EAAA,SAAA;YACY,IAAZ,CAAA,IAAgB,GAAJ,IAAI,CAAhB;YACY,IAAZ,CAAA,SAAqB,GAAT,SAAS,CAArB;SACM;;;;;QAEG,wBAAT,CAAA,SAAA,CAAA,cAAA,GAAA,UAAA,IAAA;YACI,IAAJ,KAAA,GAAA,IAAA,CAAA;YACA,qBAAuB,QAAvB,GAAA,IAAA,CAAA,SAAA,CAAiD,GAAG,CAApD,UAAA,QAAA;gBACA,OAAA,KAAA,CAAA,IAAA,CAAA,GAAA,CAAA,QAAA,CAAA,MAAA,GAAA,IAAA,GAAA,QAAA,CAAA,MAAA,CAAA,CAAA;aACA,CAAA,CAAA;;SAEA,CAAA;;;;;;;;;;;;;;"
|
12
|
-
}
|
@@ -1,2 +0,0 @@
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("rxjs"),require("rxjs/operators"),require("deepmerge")):"function"==typeof define&&define.amd?define("ngx-translate-multi-http-loader",["exports","rxjs","rxjs/operators","deepmerge"],t):t(e["ngx-translate-multi-http-loader"]={},null,e.Rx.Observable.prototype,null)}(this,function(e,n,o,i){"use strict";i=i&&i.hasOwnProperty("default")?i["default"]:i;var t=function(){function e(e,t){this.http=e,this.resources=t}return e.prototype.getTranslation=function(t){var r=this,e=this.resources.map(function(e){return r.http.get(e.prefix+t+e.suffix)});return n.forkJoin(e).pipe(o.map(function(e){return i.all(e)}))},e}();e.MultiTranslateHttpLoader=t,Object.defineProperty(e,"__esModule",{value:!0})});
|
2
|
-
//# sourceMappingURL=ngx-translate-multi-http-loader.umd.min.js.map
|
@@ -1,27 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "ngx-translate-multi-http-loader.umd.min.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/lib/multi-http-loader.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"import {HttpClient} from \"@angular/common/http\";\nimport {TranslateLoader} from \"@ngx-translate/core\";\nimport {Observable, forkJoin} from \"rxjs\";\nimport {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 return this.http.get(resource.prefix + lang + resource.suffix);\n });\n return forkJoin(requests).pipe(map(response => merge.all(response)));\n }\n}\n"
|
9
|
-
],
|
10
|
-
"names": [
|
11
|
-
"MultiTranslateHttpLoader",
|
12
|
-
"http",
|
13
|
-
"resources",
|
14
|
-
"this",
|
15
|
-
"prototype",
|
16
|
-
"getTranslation",
|
17
|
-
"lang",
|
18
|
-
"_this",
|
19
|
-
"requests",
|
20
|
-
"map",
|
21
|
-
"resource",
|
22
|
-
"get",
|
23
|
-
"prefix",
|
24
|
-
"suffix"
|
25
|
-
],
|
26
|
-
"mappings": "obAEA,IAUAA,EAAA,WACE,SAAAA,EAAFC,EAAAC,GACYC,KAAZF,KAAYA,EACAE,KAAZD,UAAYA,SAGHF,EAATI,UAAAC,eAAA,SAAAC,GACI,IAAJC,EAAAJ,KACuBK,EAAvBL,KAAAD,UAAiDO,IAAjD,SAAAC,GACA,OAAAH,EAAAN,KAAAU,IAAAD,EAAAE,OAAAN,EAAAI,EAAAG,4EATA"
|
27
|
-
}
|
@@ -1,44 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileoverview added by tsickle
|
3
|
-
* @suppress {checkTypes} checked by tsc
|
4
|
-
*/
|
5
|
-
import { forkJoin } from "rxjs";
|
6
|
-
import { map } from "rxjs/operators";
|
7
|
-
import merge from 'deepmerge';
|
8
|
-
/**
|
9
|
-
* @record
|
10
|
-
*/
|
11
|
-
export function ITranslationResource() { }
|
12
|
-
function ITranslationResource_tsickle_Closure_declarations() {
|
13
|
-
/** @type {?} */
|
14
|
-
ITranslationResource.prototype.prefix;
|
15
|
-
/** @type {?} */
|
16
|
-
ITranslationResource.prototype.suffix;
|
17
|
-
}
|
18
|
-
export class MultiTranslateHttpLoader {
|
19
|
-
/**
|
20
|
-
* @param {?} http
|
21
|
-
* @param {?} resources
|
22
|
-
*/
|
23
|
-
constructor(http, resources) {
|
24
|
-
this.http = http;
|
25
|
-
this.resources = resources;
|
26
|
-
}
|
27
|
-
/**
|
28
|
-
* @param {?} lang
|
29
|
-
* @return {?}
|
30
|
-
*/
|
31
|
-
getTranslation(lang) {
|
32
|
-
const /** @type {?} */ requests = this.resources.map(resource => {
|
33
|
-
return this.http.get(resource.prefix + lang + resource.suffix);
|
34
|
-
});
|
35
|
-
return forkJoin(requests).pipe(map(response => merge.all(response)));
|
36
|
-
}
|
37
|
-
}
|
38
|
-
function MultiTranslateHttpLoader_tsickle_Closure_declarations() {
|
39
|
-
/** @type {?} */
|
40
|
-
MultiTranslateHttpLoader.prototype.http;
|
41
|
-
/** @type {?} */
|
42
|
-
MultiTranslateHttpLoader.prototype.resources;
|
43
|
-
}
|
44
|
-
//# sourceMappingURL=multi-http-loader.js.map
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "multi-http-loader.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/lib/multi-http-loader.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"import {HttpClient} from \"@angular/common/http\";\nimport {TranslateLoader} from \"@ngx-translate/core\";\nimport {Observable, forkJoin} from \"rxjs\";\nimport {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 return this.http.get(resource.prefix + lang + resource.suffix);\n });\n return forkJoin(requests).pipe(map(response => merge.all(response)));\n }\n}\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;AAEA,OAAO,EAAa,QAAQ,EAAC,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AACnC,OAAO,KAAK,MAAM,WAAW,CAAC;;;;;;;;;;;AAQ9B,MAAM;;;;;IACJ,YACU,MACA;QADA,SAAI,GAAJ,IAAI;QACJ,cAAS,GAAT,SAAS;KACf;;;;;IAEG,cAAc,CAAC,IAAY;QAChC,uBAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC7C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;SAChE,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;;CAExE"
|
12
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "ngx-translate-multi-http-loader.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/ngx-translate-multi-http-loader.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;;;;AAIA,yCAAc,cAAc,CAAC"
|
12
|
-
}
|
package/esm2015/public_api.js
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "public_api.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/public_api.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"export * from \"./lib/multi-http-loader\";\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;AAAA,yCAAc,yBAAyB,CAAC"
|
12
|
-
}
|
@@ -1,47 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* @fileoverview added by tsickle
|
3
|
-
* @suppress {checkTypes} checked by tsc
|
4
|
-
*/
|
5
|
-
import { forkJoin } from "rxjs";
|
6
|
-
import { map } from "rxjs/operators";
|
7
|
-
import merge from 'deepmerge';
|
8
|
-
/**
|
9
|
-
* @record
|
10
|
-
*/
|
11
|
-
export function ITranslationResource() { }
|
12
|
-
function ITranslationResource_tsickle_Closure_declarations() {
|
13
|
-
/** @type {?} */
|
14
|
-
ITranslationResource.prototype.prefix;
|
15
|
-
/** @type {?} */
|
16
|
-
ITranslationResource.prototype.suffix;
|
17
|
-
}
|
18
|
-
var MultiTranslateHttpLoader = /** @class */ (function () {
|
19
|
-
/**
|
20
|
-
* @param {?} http
|
21
|
-
* @param {?} resources
|
22
|
-
*/
|
23
|
-
function MultiTranslateHttpLoader(http, resources) {
|
24
|
-
this.http = http;
|
25
|
-
this.resources = resources;
|
26
|
-
}
|
27
|
-
/**
|
28
|
-
* @param {?} lang
|
29
|
-
* @return {?}
|
30
|
-
*/
|
31
|
-
MultiTranslateHttpLoader.prototype.getTranslation = function (lang) {
|
32
|
-
var _this = this;
|
33
|
-
var /** @type {?} */ requests = this.resources.map(function (resource) {
|
34
|
-
return _this.http.get(resource.prefix + lang + resource.suffix);
|
35
|
-
});
|
36
|
-
return forkJoin(requests).pipe(map(function (response) { return merge.all(response); }));
|
37
|
-
};
|
38
|
-
return MultiTranslateHttpLoader;
|
39
|
-
}());
|
40
|
-
export { MultiTranslateHttpLoader };
|
41
|
-
function MultiTranslateHttpLoader_tsickle_Closure_declarations() {
|
42
|
-
/** @type {?} */
|
43
|
-
MultiTranslateHttpLoader.prototype.http;
|
44
|
-
/** @type {?} */
|
45
|
-
MultiTranslateHttpLoader.prototype.resources;
|
46
|
-
}
|
47
|
-
//# sourceMappingURL=multi-http-loader.js.map
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "multi-http-loader.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/lib/multi-http-loader.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"import {HttpClient} from \"@angular/common/http\";\nimport {TranslateLoader} from \"@ngx-translate/core\";\nimport {Observable, forkJoin} from \"rxjs\";\nimport {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 return this.http.get(resource.prefix + lang + resource.suffix);\n });\n return forkJoin(requests).pipe(map(response => merge.all(response)));\n }\n}\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;AAEA,OAAO,EAAa,QAAQ,EAAC,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAC,GAAG,EAAC,MAAM,gBAAgB,CAAC;AACnC,OAAO,KAAK,MAAM,WAAW,CAAC;;;;;;;;;;;AAQ9B,MAAM;;;;;IACJ,YACU,MACA;QADA,SAAI,GAAJ,IAAI;QACJ,cAAS,GAAT,SAAS;KACf;;;;;IAEG,cAAc,CAAC,IAAY;QAChC,uBAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YAC7C,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;SAChE,CAAC,CAAC;QACH,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;;CAExE"
|
12
|
-
}
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "ngx-translate-multi-http-loader.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/ngx-translate-multi-http-loader.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public_api';\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;;;;AAIA,yCAAc,cAAc,CAAC"
|
12
|
-
}
|
package/esm5/public_api.js
DELETED
package/esm5/public_api.js.map
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "public_api.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/public_api.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"export * from \"./lib/multi-http-loader\";\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;AAAA,yCAAc,yBAAyB,CAAC"
|
12
|
-
}
|
@@ -1,41 +0,0 @@
|
|
1
|
-
import { forkJoin } from 'rxjs';
|
2
|
-
import { map } from 'rxjs/operators';
|
3
|
-
import merge from 'deepmerge';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @fileoverview added by tsickle
|
7
|
-
* @suppress {checkTypes} checked by tsc
|
8
|
-
*/
|
9
|
-
class MultiTranslateHttpLoader {
|
10
|
-
/**
|
11
|
-
* @param {?} http
|
12
|
-
* @param {?} resources
|
13
|
-
*/
|
14
|
-
constructor(http, resources) {
|
15
|
-
this.http = http;
|
16
|
-
this.resources = resources;
|
17
|
-
}
|
18
|
-
/**
|
19
|
-
* @param {?} lang
|
20
|
-
* @return {?}
|
21
|
-
*/
|
22
|
-
getTranslation(lang) {
|
23
|
-
const /** @type {?} */ requests = this.resources.map(resource => {
|
24
|
-
return this.http.get(resource.prefix + lang + resource.suffix);
|
25
|
-
});
|
26
|
-
return forkJoin(requests).pipe(map(response => merge.all(response)));
|
27
|
-
}
|
28
|
-
}
|
29
|
-
|
30
|
-
/**
|
31
|
-
* @fileoverview added by tsickle
|
32
|
-
* @suppress {checkTypes} checked by tsc
|
33
|
-
*/
|
34
|
-
|
35
|
-
/**
|
36
|
-
* @fileoverview added by tsickle
|
37
|
-
* @suppress {checkTypes} checked by tsc
|
38
|
-
*/
|
39
|
-
|
40
|
-
export { MultiTranslateHttpLoader };
|
41
|
-
//# sourceMappingURL=ngx-translate-multi-http-loader.js.map
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "ngx-translate-multi-http-loader.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/lib/multi-http-loader.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"import {HttpClient} from \"@angular/common/http\";\nimport {TranslateLoader} from \"@ngx-translate/core\";\nimport {Observable, forkJoin} from \"rxjs\";\nimport {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 return this.http.get(resource.prefix + lang + resource.suffix);\n });\n return forkJoin(requests).pipe(map(response => merge.all(response)));\n }\n}\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;;;;;AAEA,AAUA,MAAA,wBAAA,CAAA;;;;;IACE,WAAF,CACY,IADZ,EAEY,SAFZ,EAAA;QACY,IAAZ,CAAA,IAAgB,GAAJ,IAAI,CAAhB;QACY,IAAZ,CAAA,SAAqB,GAAT,SAAS,CAArB;KACM;;;;;IAEG,cAAc,CAAC,IAAY,EAApC;QACI,uBAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,IAAhD;YACM,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;SAChE,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;;CAExE;;;;;;;;;;;;;;"
|
12
|
-
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import { forkJoin } from 'rxjs';
|
2
|
-
import { map } from 'rxjs/operators';
|
3
|
-
import merge from 'deepmerge';
|
4
|
-
|
5
|
-
/**
|
6
|
-
* @fileoverview added by tsickle
|
7
|
-
* @suppress {checkTypes} checked by tsc
|
8
|
-
*/
|
9
|
-
var MultiTranslateHttpLoader = /** @class */ (function () {
|
10
|
-
/**
|
11
|
-
* @param {?} http
|
12
|
-
* @param {?} resources
|
13
|
-
*/
|
14
|
-
function MultiTranslateHttpLoader(http, resources) {
|
15
|
-
this.http = http;
|
16
|
-
this.resources = resources;
|
17
|
-
}
|
18
|
-
/**
|
19
|
-
* @param {?} lang
|
20
|
-
* @return {?}
|
21
|
-
*/
|
22
|
-
MultiTranslateHttpLoader.prototype.getTranslation = function (lang) {
|
23
|
-
var _this = this;
|
24
|
-
var /** @type {?} */ requests = this.resources.map(function (resource) {
|
25
|
-
return _this.http.get(resource.prefix + lang + resource.suffix);
|
26
|
-
});
|
27
|
-
return forkJoin(requests).pipe(map(function (response) { return merge.all(response); }));
|
28
|
-
};
|
29
|
-
return MultiTranslateHttpLoader;
|
30
|
-
}());
|
31
|
-
|
32
|
-
/**
|
33
|
-
* @fileoverview added by tsickle
|
34
|
-
* @suppress {checkTypes} checked by tsc
|
35
|
-
*/
|
36
|
-
|
37
|
-
/**
|
38
|
-
* @fileoverview added by tsickle
|
39
|
-
* @suppress {checkTypes} checked by tsc
|
40
|
-
*/
|
41
|
-
|
42
|
-
export { MultiTranslateHttpLoader };
|
43
|
-
//# sourceMappingURL=ngx-translate-multi-http-loader.js.map
|
@@ -1,12 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"version": 3,
|
3
|
-
"file": "ngx-translate-multi-http-loader.js",
|
4
|
-
"sources": [
|
5
|
-
"ng://ngx-translate-multi-http-loader/projects/ngx-translate/multi-http-loader/src/lib/multi-http-loader.ts"
|
6
|
-
],
|
7
|
-
"sourcesContent": [
|
8
|
-
"import {HttpClient} from \"@angular/common/http\";\nimport {TranslateLoader} from \"@ngx-translate/core\";\nimport {Observable, forkJoin} from \"rxjs\";\nimport {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 return this.http.get(resource.prefix + lang + resource.suffix);\n });\n return forkJoin(requests).pipe(map(response => merge.all(response)));\n }\n}\n"
|
9
|
-
],
|
10
|
-
"names": [],
|
11
|
-
"mappings": ";;;;;;;;AAEA,AAUA,IAAA,wBAAA,kBAAA,YAAA;;;;;IACE,SAAF,wBAAA,CAAA,IAAA,EAAA,SAAA,EAAA;QACY,IAAZ,CAAA,IAAgB,GAAJ,IAAI,CAAhB;QACY,IAAZ,CAAA,SAAqB,GAAT,SAAS,CAArB;KACM;;;;;IAEG,wBAAT,CAAA,SAAA,CAAA,cAAA,GAAA,UAAA,IAAA,EAAA;QACI,IAAJ,KAAA,GAAA,IAAA,CAAA;QACA,qBAAuB,QAAvB,GAAA,IAAA,CAAA,SAAA,CAAiD,GAAG,CAApD,UAAA,QAAA,EAAA;YACA,OAAA,KAAA,CAAA,IAAA,CAAA,GAAA,CAAA,QAAA,CAAA,MAAA,GAAA,IAAA,GAAA,QAAA,CAAA,MAAA,CAAA,CAAA;SACA,CAAA,CAAA;;KAEA,CAAA;;;;;;;;;;;;;;;;"
|
12
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"__symbolic":"module","version":4,"metadata":{"ITranslationResource":{"__symbolic":"interface"},"MultiTranslateHttpLoader":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":14,"character":18},{"__symbolic":"reference","name":"Array","arguments":[{"__symbolic":"reference","name":"any"}]}]}],"getTranslation":[{"__symbolic":"method"}]}}},"origins":{"ITranslationResource":"./lib/multi-http-loader","MultiTranslateHttpLoader":"./lib/multi-http-loader"},"importAs":"ngx-translate-multi-http-loader"}
|
package/public_api.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from "./lib/multi-http-loader";
|