ngx-translate-multi-http-loader 9.3.2 → 15.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,102 +1,102 @@
1
- # @ngx-translate/multi-http-loader [![npm version](https://img.shields.io/npm/v/ngx-translate-multi-http-loader.svg)](https://www.npmjs.com/package/ngx-translate-multi-http-loader)
2
-
3
-
4
- A loader for [ngx-translate](https://github.com/ngx-translate/core) that loads translations using http.
5
-
6
- Angular 14 example: https://stackblitz.com/edit/ngx-translate-multi-http-loader-sample-2clau3?file=src/app/app.module.ts
7
-
8
- Angular 6 example: https://stackblitz.com/edit/ngx-translate-multi-http-loader-sample
9
-
10
- Get the complete changelog here: https://github.com/rbalet/ngx-translate-multi-http-loader/releases
11
-
12
- * [Installation](#installation)
13
- * [Usage](#usage)
14
-
15
- ## breaking change: v9.0.0
16
- * This library is now using `httpBackend` instead of the `httpClient`, to avoid being delayed by interceptor, which was creating errors while loading.
17
- * From the v9, the library will only be using a list of `string[]` so `prefix` & `suffix` aren't needed anymore and `.json` gonna be the default suffix.
18
-
19
- ## Installation
20
-
21
- We assume that you already installed [ngx-translate](https://github.com/ngx-translate/core).
22
-
23
- Now you need to install the npm module for `MultiTranslateHttpLoader`:
24
-
25
- ```sh
26
- npm install ngx-translate-multi-http-loader --save
27
- ```
28
-
29
- Choose the version corresponding to your Angular version:
30
-
31
- | Angular | @ngx-translate/core | ngx-translate-multi-http-loader |
32
- | ------- | ------------------- | ------------------------------- |
33
- | 14 | 14.x+ | 8.x+ |
34
- | 13 | 14.x+ | 7.x+ |
35
- | 6 | 10.x+ | 1.x+ |
36
-
37
- ## Usage
38
- _The `MultiTranslateHttpLoader` uses HttpBackend to load translations, therefore :_
39
- 1. Create and export a new `HttpLoaderFactory` function
40
- 2. Import the `HttpClientModule` from `@angular/common/http`
41
- 3. Setup the `TranslateModule` to use the `MultiTranslateHttpLoader`
42
-
43
- ```typescript
44
- import {NgModule} from '@angular/core';
45
- import {BrowserModule} from '@angular/platform-browser';
46
- import {HttpClientModule, HttpBackend} from '@angular/common/http';
47
- import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
48
- import {MultiTranslateHttpLoader} from 'ngx-translate-multi-http-loader';
49
- import {AppComponent} from './app';
50
-
51
- // AoT requires an exported function for factories
52
- export function HttpLoaderFactory(_httpBackend: HttpBackend) {
53
- return new MultiTranslateHttpLoader(_httpBackend, ['/assets/i18n/core/', '/assets/i18n/vendors/']);
54
- }
55
-
56
- @NgModule({
57
- imports: [
58
- BrowserModule,
59
- HttpClientModule,
60
- TranslateModule.forRoot({
61
- loader: {
62
- provide: TranslateLoader,
63
- useFactory: HttpLoaderFactory,
64
- deps: [HttpBackend]
65
- }
66
- })
67
- ],
68
- bootstrap: [AppComponent]
69
- })
70
- export class AppModule { }
71
- ```
72
-
73
- The `MultiTranslateHttpLoader` takes a list of `string[]` or `ITranslationResource[]`.
74
-
75
- ### String[]
76
- For example `['/assets/i18n/core/', '/assets/i18n/vendors/']`,
77
- will load your translations files for the lang "en" from : `/assets/i18n/core/en.json` and `/assets/i18n/vendors/en.json`
78
-
79
- ### Custom suffix
80
- **For now this loader only support the `json` format.**
81
-
82
- Instead of an array of `string[]`,
83
- you may pass a list of parameters:
84
- - `prefix: string = '/assets/i18n/'`
85
- - `suffix: string = '.json'`
86
- - `optional: boolean = true`
87
-
88
- ```typescript
89
- export function HttpLoaderFactory(_httpBackend: HttpBackend) {
90
- return new MultiTranslateHttpLoader(_httpBackend, [
91
- {prefix: './assets/i18n/core/', suffix: '.json'},
92
- {prefix: './assets/i18n/vendors/'}, // , "suffix: '.json'" being the default value
93
- {prefix: './assets/i18n/non-existent/', optional: true}, // Wont create any log
94
- ]);
95
- }
96
- ```
97
-
98
- The loader will merge all translation files from the server using [deepmerge-ts](https://www.npmjs.com/package/deepmerge-ts).
99
-
100
- ## Authors and acknowledgment
101
- * maintainer [Raphaël Balet](https://github.com/rbalet)
102
- * Former maintainer [Dennis Keil](https://github.com/denniske)
1
+ # @ngx-translate/multi-http-loader [![npm version](https://img.shields.io/npm/v/ngx-translate-multi-http-loader.svg)](https://www.npmjs.com/package/ngx-translate-multi-http-loader)
2
+
3
+
4
+ A loader for [ngx-translate](https://github.com/ngx-translate/core) that loads translations using http.
5
+
6
+ Angular 14 example: https://stackblitz.com/edit/ngx-translate-multi-http-loader-sample-2clau3?file=src/app/app.module.ts
7
+
8
+ Angular 6 example: https://stackblitz.com/edit/ngx-translate-multi-http-loader-sample
9
+
10
+ Get the complete changelog here: https://github.com/rbalet/ngx-translate-multi-http-loader/releases
11
+
12
+ * [Installation](#installation)
13
+ * [Usage](#usage)
14
+
15
+ ## breaking change: v9.0.0
16
+ * This library is now using `httpBackend` instead of the `httpClient`, to avoid being delayed by interceptor, which was creating errors while loading.
17
+ * From the v9, the library will only be using a list of `string[]` so `prefix` & `suffix` aren't needed anymore and `.json` gonna be the default suffix.
18
+
19
+ ## Installation
20
+
21
+ We assume that you already installed [ngx-translate](https://github.com/ngx-translate/core).
22
+
23
+ Now you need to install the npm module for `MultiTranslateHttpLoader`:
24
+
25
+ ```sh
26
+ npm install ngx-translate-multi-http-loader --save
27
+ ```
28
+
29
+ Choose the version corresponding to your Angular version:
30
+
31
+ | Angular | @ngx-translate/core | ngx-translate-multi-http-loader |
32
+ | ------- | ------------------- | ------------------------------- |
33
+ | 14 | 14.x+ | 8.x+ |
34
+ | 13 | 14.x+ | 7.x+ |
35
+ | 6 | 10.x+ | 1.x+ |
36
+
37
+ ## Usage
38
+ _The `MultiTranslateHttpLoader` uses HttpBackend to load translations, therefore :_
39
+ 1. Create and export a new `HttpLoaderFactory` function
40
+ 2. Import the `HttpClientModule` from `@angular/common/http`
41
+ 3. Setup the `TranslateModule` to use the `MultiTranslateHttpLoader`
42
+
43
+ ```typescript
44
+ import {NgModule} from '@angular/core';
45
+ import {BrowserModule} from '@angular/platform-browser';
46
+ import {HttpClientModule, HttpBackend} from '@angular/common/http';
47
+ import {TranslateModule, TranslateLoader} from '@ngx-translate/core';
48
+ import {MultiTranslateHttpLoader} from 'ngx-translate-multi-http-loader';
49
+ import {AppComponent} from './app';
50
+
51
+ // AoT requires an exported function for factories
52
+ export function HttpLoaderFactory(_httpBackend: HttpBackend) {
53
+ return new MultiTranslateHttpLoader(_httpBackend, ['/assets/i18n/core/', '/assets/i18n/vendors/']);
54
+ }
55
+
56
+ @NgModule({
57
+ imports: [
58
+ BrowserModule,
59
+ HttpClientModule,
60
+ TranslateModule.forRoot({
61
+ loader: {
62
+ provide: TranslateLoader,
63
+ useFactory: HttpLoaderFactory,
64
+ deps: [HttpBackend]
65
+ }
66
+ })
67
+ ],
68
+ bootstrap: [AppComponent]
69
+ })
70
+ export class AppModule { }
71
+ ```
72
+
73
+ The `MultiTranslateHttpLoader` takes a list of `string[]` or `ITranslationResource[]`.
74
+
75
+ ### String[]
76
+ For example `['/assets/i18n/core/', '/assets/i18n/vendors/']`,
77
+ will load your translations files for the lang "en" from : `/assets/i18n/core/en.json` and `/assets/i18n/vendors/en.json`
78
+
79
+ ### Custom suffix
80
+ **For now this loader only support the `json` format.**
81
+
82
+ Instead of an array of `string[]`,
83
+ you may pass a list of parameters:
84
+ - `prefix: string = '/assets/i18n/'`
85
+ - `suffix: string = '.json'`
86
+ - `optional: boolean = true`
87
+
88
+ ```typescript
89
+ export function HttpLoaderFactory(_httpBackend: HttpBackend) {
90
+ return new MultiTranslateHttpLoader(_httpBackend, [
91
+ {prefix: './assets/i18n/core/', suffix: '.json'},
92
+ {prefix: './assets/i18n/vendors/'}, // , "suffix: '.json'" being the default value
93
+ {prefix: './assets/i18n/non-existent/', optional: true}, // Wont create any log
94
+ ]);
95
+ }
96
+ ```
97
+
98
+ The loader will merge all translation files from the server using [deepmerge-ts](https://www.npmjs.com/package/deepmerge-ts).
99
+
100
+ ## Authors and acknowledgment
101
+ * maintainer [Raphaël Balet](https://github.com/rbalet)
102
+ * Former maintainer [Dennis Keil](https://github.com/denniske)
@@ -1,30 +1,30 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { deepmerge } from 'deepmerge-ts';
3
- import { forkJoin, of } from 'rxjs';
4
- import { catchError, map } from 'rxjs/operators';
5
- export class MultiTranslateHttpLoader {
6
- constructor(_handler, _resourcesPrefix) {
7
- this._handler = _handler;
8
- this._resourcesPrefix = _resourcesPrefix;
9
- }
10
- getTranslation(lang) {
11
- const requests = this._resourcesPrefix.map((resource) => {
12
- let path;
13
- if (resource.prefix)
14
- path = `${resource.prefix}${lang}${resource.suffix || '.json'}`;
15
- else
16
- path = `${resource}${lang}.json`;
17
- return new HttpClient(this._handler).get(path).pipe(catchError((res) => {
18
- if (!resource.optional) {
19
- console.group();
20
- console.error('Something went wrong for the following translation file:', path);
21
- console.error(res);
22
- console.groupEnd();
23
- }
24
- return of({});
25
- }));
26
- });
27
- return forkJoin(requests).pipe(map((response) => deepmerge(...response)));
28
- }
29
- }
30
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXVsdGktaHR0cC1sb2FkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9tdWx0aS1odHRwLWxvYWRlci9zcmMvbGliL211bHRpLWh0dHAtbG9hZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBZSxVQUFVLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQTtBQUU5RCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sY0FBYyxDQUFBO0FBQ3hDLE9BQU8sRUFBRSxRQUFRLEVBQWMsRUFBRSxFQUFFLE1BQU0sTUFBTSxDQUFBO0FBQy9DLE9BQU8sRUFBRSxVQUFVLEVBQUUsR0FBRyxFQUFFLE1BQU0sZ0JBQWdCLENBQUE7QUFRaEQsTUFBTSxPQUFPLHdCQUF3QjtJQUNuQyxZQUNVLFFBQXFCLEVBQ3JCLGdCQ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mVxdWVzdHM6IE9ic2VydmFibGU8T2JqZWN0IHwge30+W10gPSB0aGlzLl9yZXNvdXJjZXNQcmVmaXgubWFwKChyZXNvdXJjZSkgPT4ge1xyXG4gICAgICBsZXQgcGF0aDogc3RyaW5nXHJcbiAgICAgIGlmIChyZXNvdXJjZS5wcmVmaXgpIHBhdGggPSBgJHtyZXNvdXJjZS5wcmVmaXh9JHtsYW5nfSR7cmVzb3VyY2Uuc3VmZml4IHx8ICcuanNvbid9YFxyXG4gICAgICBlbHNlIHBhdGggPSBgJHtyZXNvdXJjZX0ke2xhbmd9Lmpzb25gXHJcblxyXG4gICAgICByZXR1cm4gbmV3IEh0dHBDbGllbnQodGhpcy5faGFuZGxlcikuZ2V0KHBhdGgpLnBpcGUoXHJcbiAgICAgICAgY2F0Y2hFcnJvcigocmVzKSA9PiB7XHJcbiAgICAgICAgICBpZiAoIXJlc291cmNlLm9wdGlvbmFsKSB7XHJcbiAgICAgICAgICAgIGNvbnNvbGUuZ3JvdXAoKVxyXG4gICAgICAgICAgICBjb25zb2xlLmVycm9yKCdTb21ldGhpbmcgd2VudCB3cm9uZyBmb3IgdGhlIGZvbGxvd2luZyB0cmFuc2xhdGlvbiBmaWxlOicsIHBhdGgpXHJcbiAgICAgICAgICAgIGNvbnNvbGUuZXJyb3IocmVzKVxyXG4gICAgICAgICAgICBjb25zb2xlLmdyb3VwRW5kKClcclxuICAgICAgICAgIH1cclxuICAgICAgICAgIHJldHVybiBvZih7fSlcclxuICAgICAgICB9KSxcclxuICAgICAgKVxyXG4gICAgfSlcclxuXHJcbiAgICByZXR1cm4gZm9ya0pvaW4ocmVxdWVzdHMpLnBpcGUobWFwKChyZXNwb25zZSkgPT4gZGVlcG1lcmdlKC4uLnJlc3BvbnNlKSkpXHJcbiAgfVxyXG59XHJcbiJdfQ==
1
+ import { HttpClient } from '@angular/common/http';
2
+ import { deepmerge } from 'deepmerge-ts';
3
+ import { forkJoin, of } from 'rxjs';
4
+ import { catchError, map } from 'rxjs/operators';
5
+ export class MultiTranslateHttpLoader {
6
+ constructor(_handler, _resourcesPrefix) {
7
+ this._handler = _handler;
8
+ this._resourcesPrefix = _resourcesPrefix;
9
+ }
10
+ getTranslation(lang) {
11
+ const requests = this._resourcesPrefix.map((resource) => {
12
+ let path;
13
+ if (resource.prefix)
14
+ path = `${resource.prefix}${lang}${resource.suffix || '.json'}`;
15
+ else
16
+ path = `${resource}${lang}.json`;
17
+ return new HttpClient(this._handler).get(path).pipe(catchError((res) => {
18
+ if (!resource.optional) {
19
+ console.group();
20
+ console.error('Something went wrong for the following translation file:', path);
21
+ console.error(res);
22
+ console.groupEnd();
23
+ }
24
+ return of({});
25
+ }));
26
+ });
27
+ return forkJoin(requests).pipe(map((response) => deepmerge(...response)));
28
+ }
29
+ }
30
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibXVsdGktaHR0cC1sb2FkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9wcm9qZWN0cy9tdWx0aS1odHRwLWxvYWRlci9zcmMvbGliL211bHRpLWh0dHAtbG9hZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBZSxVQUFVLEVBQUUsTUFBTSxzQkFBc0IsQ0FBQTtBQUU5RCxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sY0FBYyxDQUFBO0FBQ3hDLE9BQU8sRUFBRSxRQUFRLEVBQWMsRUFBRSxFQUFFLE1BQU0sTUFBTSxDQUFBO0FBQy9DLE9BQU8sRUFBRSxVQUFVLEVBQUUsR0FBRyxFQUFFLE1BQU0sZ0JBQWdCLENBQUE7QUFRaEQsTUFBTSxPQUFPLHdCQUF3QjtJQUNuQyxZQUNVLFFBQXFCLEVBQ3JCLGdCQUFtRDtRQURuRCxhQUFRLEdBQVIsUUFBUSxDQUFhO1FBQ3JCLHFCQUFnQixHQUFoQixnQkFBZ0Is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BwYXRoOiBzdHJpbmdcbiAgICAgIGlmIChyZXNvdXJjZS5wcmVmaXgpIHBhdGggPSBgJHtyZXNvdXJjZS5wcmVmaXh9JHtsYW5nfSR7cmVzb3VyY2Uuc3VmZml4IHx8ICcuanNvbid9YFxuICAgICAgZWxzZSBwYXRoID0gYCR7cmVzb3VyY2V9JHtsYW5nfS5qc29uYFxuXG4gICAgICByZXR1cm4gbmV3IEh0dHBDbGllbnQodGhpcy5faGFuZGxlcikuZ2V0KHBhdGgpLnBpcGUoXG4gICAgICAgIGNhdGNoRXJyb3IoKHJlcykgPT4ge1xuICAgICAgICAgIGlmICghcmVzb3VyY2Uub3B0aW9uYWwpIHtcbiAgICAgICAgICAgIGNvbnNvbGUuZ3JvdXAoKVxuICAgICAgICAgICAgY29uc29sZS5lcnJvcignU29tZXRoaW5nIHdlbnQgd3JvbmcgZm9yIHRoZSBmb2xsb3dpbmcgdHJhbnNsYXRpb24gZmlsZTonLCBwYXRoKVxuICAgICAgICAgICAgY29uc29sZS5lcnJvcihyZXMpXG4gICAgICAgICAgICBjb25zb2xlLmdyb3VwRW5kKClcbiAgICAgICAgICB9XG4gICAgICAgICAgcmV0dXJuIG9mKHt9KVxuICAgICAgICB9KSxcbiAgICAgIClcbiAgICB9KVxuXG4gICAgcmV0dXJuIGZvcmtKb2luKHJlcXVlc3RzKS5waXBlKG1hcCgocmVzcG9uc2UpID0+IGRlZXBtZXJnZSguLi5yZXNwb25zZSkpKVxuICB9XG59XG4iXX0=
@@ -1,5 +1,5 @@
1
- /**
2
- * Generated bundle index. Do not edit.
3
- */
4
- export * from './public-api';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
5
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmd4LXRyYW5zbGF0ZS1tdWx0aS1odHRwLWxvYWRlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL211bHRpLWh0dHAtbG9hZGVyL3NyYy9uZ3gtdHJhbnNsYXRlLW11bHRpLWh0dHAtbG9hZGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
@@ -1,2 +1,2 @@
1
- export * from './lib/multi-http-loader';
2
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL211bHRpLWh0dHAtbG9hZGVyL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMseUJBQXlCLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9tdWx0aS1odHRwLWxvYWRlcidcclxuIl19
1
+ export * from './lib/multi-http-loader';
2
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3Byb2plY3RzL211bHRpLWh0dHAtbG9hZGVyL3NyYy9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMseUJBQXlCLENBQUEiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9tdWx0aS1odHRwLWxvYWRlcidcbiJdfQ==
@@ -3,34 +3,34 @@ import { deepmerge } from 'deepmerge-ts';
3
3
  import { of, forkJoin } from 'rxjs';
4
4
  import { catchError, map } from 'rxjs/operators';
5
5
 
6
- class MultiTranslateHttpLoader {
7
- constructor(_handler, _resourcesPrefix) {
8
- this._handler = _handler;
9
- this._resourcesPrefix = _resourcesPrefix;
10
- }
11
- getTranslation(lang) {
12
- const requests = this._resourcesPrefix.map((resource) => {
13
- let path;
14
- if (resource.prefix)
15
- path = `${resource.prefix}${lang}${resource.suffix || '.json'}`;
16
- else
17
- path = `${resource}${lang}.json`;
18
- return new HttpClient(this._handler).get(path).pipe(catchError((res) => {
19
- if (!resource.optional) {
20
- console.group();
21
- console.error('Something went wrong for the following translation file:', path);
22
- console.error(res);
23
- console.groupEnd();
24
- }
25
- return of({});
26
- }));
27
- });
28
- return forkJoin(requests).pipe(map((response) => deepmerge(...response)));
29
- }
6
+ class MultiTranslateHttpLoader {
7
+ constructor(_handler, _resourcesPrefix) {
8
+ this._handler = _handler;
9
+ this._resourcesPrefix = _resourcesPrefix;
10
+ }
11
+ getTranslation(lang) {
12
+ const requests = this._resourcesPrefix.map((resource) => {
13
+ let path;
14
+ if (resource.prefix)
15
+ path = `${resource.prefix}${lang}${resource.suffix || '.json'}`;
16
+ else
17
+ path = `${resource}${lang}.json`;
18
+ return new HttpClient(this._handler).get(path).pipe(catchError((res) => {
19
+ if (!resource.optional) {
20
+ console.group();
21
+ console.error('Something went wrong for the following translation file:', path);
22
+ console.error(res);
23
+ console.groupEnd();
24
+ }
25
+ return of({});
26
+ }));
27
+ });
28
+ return forkJoin(requests).pipe(map((response) => deepmerge(...response)));
29
+ }
30
30
  }
31
31
 
32
- /**
33
- * Generated bundle index. Do not edit.
32
+ /**
33
+ * Generated bundle index. Do not edit.
34
34
  */
35
35
 
36
36
  export { MultiTranslateHttpLoader };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ngx-translate-multi-http-loader.mjs","sources":["../../../projects/multi-http-loader/src/lib/multi-http-loader.ts","../../../projects/multi-http-loader/src/ngx-translate-multi-http-loader.ts"],"sourcesContent":["import { HttpBackend, HttpClient } from '@angular/common/http'\nimport { TranslateLoader } from '@ngx-translate/core'\nimport { deepmerge } from 'deepmerge-ts'\nimport { forkJoin, Observable, of } from 'rxjs'\nimport { catchError, map } from 'rxjs/operators'\n\nexport interface ITranslationResource {\n prefix: string\n suffix?: string\n optional?: boolean\n}\n\nexport class MultiTranslateHttpLoader implements TranslateLoader {\n constructor(\n private _handler: HttpBackend,\n private _resourcesPrefix: string[] | ITranslationResource[],\n ) {}\n\n public getTranslation(lang: string): Observable<any> {\n const requests: Observable<Object | {}>[] = this._resourcesPrefix.map((resource) => {\n let path: string\n if (resource.prefix) path = `${resource.prefix}${lang}${resource.suffix || '.json'}`\n else path = `${resource}${lang}.json`\n\n return new HttpClient(this._handler).get(path).pipe(\n catchError((res) => {\n if (!resource.optional) {\n console.group()\n console.error('Something went wrong for the following translation file:', path)\n console.error(res)\n console.groupEnd()\n }\n return of({})\n }),\n )\n })\n\n return forkJoin(requests).pipe(map((response) => deepmerge(...response)))\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAYa,wBAAwB,CAAA;IACnC,WACU,CAAA,QAAqB,EACrB,gBAAmD,EAAA;QADnD,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAa;QACrB,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAmC;KACzD;AAEG,IAAA,cAAc,CAAC,IAAY,EAAA;QAChC,MAAM,QAAQ,GAA8B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAI;AACjF,YAAA,IAAI,IAAY,CAAA;YAChB,IAAI,QAAQ,CAAC,MAAM;AAAE,gBAAA,IAAI,GAAG,CAAA,EAAG,QAAQ,CAAC,MAAM,CAAG,EAAA,IAAI,CAAG,EAAA,QAAQ,CAAC,MAAM,IAAI,OAAO,EAAE,CAAA;;AAC/E,gBAAA,IAAI,GAAG,CAAG,EAAA,QAAQ,CAAG,EAAA,IAAI,OAAO,CAAA;YAErC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CACjD,UAAU,CAAC,CAAC,GAAG,KAAI;AACjB,gBAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;oBACtB,OAAO,CAAC,KAAK,EAAE,CAAA;AACf,oBAAA,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,IAAI,CAAC,CAAA;AAC/E,oBAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;oBAClB,OAAO,CAAC,QAAQ,EAAE,CAAA;AACnB,iBAAA;AACD,gBAAA,OAAO,EAAE,CAAC,EAAE,CAAC,CAAA;aACd,CAAC,CACH,CAAA;AACH,SAAC,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;KAC1E;AACF;;ACvCD;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -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 './public-api';
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="ngx-translate-multi-http-loader" />
5
+ export * from './public-api';
@@ -1,14 +1,14 @@
1
- import { HttpBackend } 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
- optional?: boolean;
8
- }
9
- export declare class MultiTranslateHttpLoader implements TranslateLoader {
10
- private _handler;
11
- private _resourcesPrefix;
12
- constructor(_handler: HttpBackend, _resourcesPrefix: string[] | ITranslationResource[]);
13
- getTranslation(lang: string): Observable<any>;
14
- }
1
+ import { HttpBackend } 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
+ optional?: boolean;
8
+ }
9
+ export declare class MultiTranslateHttpLoader implements TranslateLoader {
10
+ private _handler;
11
+ private _resourcesPrefix;
12
+ constructor(_handler: HttpBackend, _resourcesPrefix: string[] | ITranslationResource[]);
13
+ getTranslation(lang: string): Observable<any>;
14
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ngx-translate-multi-http-loader",
3
- "version": "9.3.2",
3
+ "version": "15.0.0",
4
4
  "license": "MIT",
5
5
  "author": "Raphael Balet",
6
6
  "maintainers": [
@@ -20,20 +20,16 @@
20
20
  "url": "https://github.com/rbalet/ngx-translate-multi-http-loader"
21
21
  },
22
22
  "dependencies": {
23
- "tslib": "^2.5.0"
23
+ "tslib": "^2.5.2"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@angular/common": ">=13.0.0",
27
27
  "@angular/core": ">=13.0.0",
28
- "@ngx-translate/core": ">=14.0.0",
29
- "deepmerge-ts": "^4.3.0",
30
- "rxjs": "^7.8.0"
28
+ "@ngx-translate/core": ">=15.0.0",
29
+ "deepmerge-ts": "^5.1.0",
30
+ "rxjs": "^7.8.1"
31
31
  },
32
- "module": "fesm2015/ngx-translate-multi-http-loader.mjs",
33
- "es2020": "fesm2020/ngx-translate-multi-http-loader.mjs",
34
- "esm2020": "esm2020/ngx-translate-multi-http-loader.mjs",
35
- "fesm2020": "fesm2020/ngx-translate-multi-http-loader.mjs",
36
- "fesm2015": "fesm2015/ngx-translate-multi-http-loader.mjs",
32
+ "module": "fesm2022/ngx-translate-multi-http-loader.mjs",
37
33
  "typings": "index.d.ts",
38
34
  "exports": {
39
35
  "./package.json": {
@@ -41,11 +37,9 @@
41
37
  },
42
38
  ".": {
43
39
  "types": "./index.d.ts",
44
- "esm2020": "./esm2020/ngx-translate-multi-http-loader.mjs",
45
- "es2020": "./fesm2020/ngx-translate-multi-http-loader.mjs",
46
- "es2015": "./fesm2015/ngx-translate-multi-http-loader.mjs",
47
- "node": "./fesm2015/ngx-translate-multi-http-loader.mjs",
48
- "default": "./fesm2020/ngx-translate-multi-http-loader.mjs"
40
+ "esm2022": "./esm2022/ngx-translate-multi-http-loader.mjs",
41
+ "esm": "./esm2022/ngx-translate-multi-http-loader.mjs",
42
+ "default": "./fesm2022/ngx-translate-multi-http-loader.mjs"
49
43
  }
50
44
  },
51
45
  "sideEffects": false
package/public-api.d.ts CHANGED
@@ -1 +1 @@
1
- export * from './lib/multi-http-loader';
1
+ export * from './lib/multi-http-loader';
@@ -1,37 +0,0 @@
1
- import { HttpClient } from '@angular/common/http';
2
- import { deepmerge } from 'deepmerge-ts';
3
- import { of, forkJoin } from 'rxjs';
4
- import { catchError, map } from 'rxjs/operators';
5
-
6
- class MultiTranslateHttpLoader {
7
- constructor(_handler, _resourcesPrefix) {
8
- this._handler = _handler;
9
- this._resourcesPrefix = _resourcesPrefix;
10
- }
11
- getTranslation(lang) {
12
- const requests = this._resourcesPrefix.map((resource) => {
13
- let path;
14
- if (resource.prefix)
15
- path = `${resource.prefix}${lang}${resource.suffix || '.json'}`;
16
- else
17
- path = `${resource}${lang}.json`;
18
- return new HttpClient(this._handler).get(path).pipe(catchError((res) => {
19
- if (!resource.optional) {
20
- console.group();
21
- console.error('Something went wrong for the following translation file:', path);
22
- console.error(res);
23
- console.groupEnd();
24
- }
25
- return of({});
26
- }));
27
- });
28
- return forkJoin(requests).pipe(map((response) => deepmerge(...response)));
29
- }
30
- }
31
-
32
- /**
33
- * Generated bundle index. Do not edit.
34
- */
35
-
36
- export { MultiTranslateHttpLoader };
37
- //# sourceMappingURL=ngx-translate-multi-http-loader.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ngx-translate-multi-http-loader.mjs","sources":["../../../projects/multi-http-loader/src/lib/multi-http-loader.ts","../../../projects/multi-http-loader/src/ngx-translate-multi-http-loader.ts"],"sourcesContent":["import { HttpBackend, HttpClient } from '@angular/common/http'\r\nimport { TranslateLoader } from '@ngx-translate/core'\r\nimport { deepmerge } from 'deepmerge-ts'\r\nimport { forkJoin, Observable, of } from 'rxjs'\r\nimport { catchError, map } from 'rxjs/operators'\r\n\r\nexport interface ITranslationResource {\r\n prefix: string\r\n suffix?: string\r\n optional?: boolean\r\n}\r\n\r\nexport class MultiTranslateHttpLoader implements TranslateLoader {\r\n constructor(\r\n private _handler: HttpBackend,\r\n private _resourcesPrefix: string[] | ITranslationResource[],\r\n ) {}\r\n\r\n public getTranslation(lang: string): Observable<any> {\r\n const requests: Observable<Object | {}>[] = this._resourcesPrefix.map((resource) => {\r\n let path: string\r\n if (resource.prefix) path = `${resource.prefix}${lang}${resource.suffix || '.json'}`\r\n else path = `${resource}${lang}.json`\r\n\r\n return new HttpClient(this._handler).get(path).pipe(\r\n catchError((res) => {\r\n if (!resource.optional) {\r\n console.group()\r\n console.error('Something went wrong for the following translation file:', path)\r\n console.error(res)\r\n console.groupEnd()\r\n }\r\n return of({})\r\n }),\r\n )\r\n })\r\n\r\n return forkJoin(requests).pipe(map((response) => deepmerge(...response)))\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAYa,wBAAwB,CAAA;IACnC,WACU,CAAA,QAAqB,EACrB,gBAAmD,EAAA;AADnD,QAAA,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAa;AACrB,QAAA,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAmC;KACzD;AAEG,IAAA,cAAc,CAAC,IAAY,EAAA;QAChC,MAAM,QAAQ,GAA8B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAI;AACjF,YAAA,IAAI,IAAY,CAAA;YAChB,IAAI,QAAQ,CAAC,MAAM;AAAE,gBAAA,IAAI,GAAG,CAAA,EAAG,QAAQ,CAAC,MAAM,CAAG,EAAA,IAAI,CAAG,EAAA,QAAQ,CAAC,MAAM,IAAI,OAAO,EAAE,CAAA;;AAC/E,gBAAA,IAAI,GAAG,CAAG,EAAA,QAAQ,CAAG,EAAA,IAAI,OAAO,CAAA;YAErC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CACjD,UAAU,CAAC,CAAC,GAAG,KAAI;AACjB,gBAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE;oBACtB,OAAO,CAAC,KAAK,EAAE,CAAA;AACf,oBAAA,OAAO,CAAC,KAAK,CAAC,0DAA0D,EAAE,IAAI,CAAC,CAAA;AAC/E,oBAAA,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;oBAClB,OAAO,CAAC,QAAQ,EAAE,CAAA;AACnB,iBAAA;AACD,gBAAA,OAAO,EAAE,CAAC,EAAE,CAAC,CAAA;aACd,CAAC,CACH,CAAA;AACH,SAAC,CAAC,CAAA;QAEF,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAK,SAAS,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;KAC1E;AACF;;ACvCD;;AAEG;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ngx-translate-multi-http-loader.mjs","sources":["../../../projects/multi-http-loader/src/lib/multi-http-loader.ts","../../../projects/multi-http-loader/src/ngx-translate-multi-http-loader.ts"],"sourcesContent":["import { HttpBackend, HttpClient } from '@angular/common/http'\r\nimport { TranslateLoader } from '@ngx-translate/core'\r\nimport { deepmerge } from 'deepmerge-ts'\r\nimport { forkJoin, Observable, of } from 'rxjs'\r\nimport { catchError, map } from 'rxjs/operators'\r\n\r\nexport interface ITranslationResource {\r\n prefix: string\r\n suffix?: string\r\n optional?: boolean\r\n}\r\n\r\nexport class MultiTranslateHttpLoader implements TranslateLoader {\r\n constructor(\r\n private _handler: HttpBackend,\r\n private _resourcesPrefix: string[] | ITranslationResource[],\r\n ) {}\r\n\r\n public getTranslation(lang: string): Observable<any> {\r\n const requests: Observable<Object | {}>[] = this._resourcesPrefix.map((resource) => {\r\n let path: string\r\n if (resource.prefix) path = `${resource.prefix}${lang}${resource.suffix || '.json'}`\r\n else path = `${resource}${lang}.json`\r\n\r\n return new HttpClient(this._handler).get(path).pipe(\r\n catchError((res) => {\r\n if (!resource.optional) {\r\n console.group()\r\n console.error('Something went wrong for the following translation file:', path)\r\n console.error(res)\r\n console.groupEnd()\r\n }\r\n return of({})\r\n }),\r\n )\r\n })\r\n\r\n return forkJoin(requests).pipe(map((response) => deepmerge(...response)))\r\n }\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;MAYa,wBAAwB,CAAA;IACnC,WACU,CAAA,QAAqB,EACrB,gBAAmD,EAAA;QADnD,IAAQ,CAAA,QAAA,GAAR,QAAQ,CAAa;QACrB,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAmC;KACzD;AAEG,IAAA,cAAc,CAAC,IAAY,EAAA;QAChC,MAAM,QAAQ,GAA8B,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAAQ,KAAI;AACjF,YAAA,IAAI,IAAY,CAAA;YAChB,IAAI,QAAQ,CAAC,MAAM;AAAE,gBAAA,IAAI,GAAG,CAAA,EAAG,QAAQ,CAAC,MAAM,CAAG,EAAA,IAAI,CAAG,EAAA,QAAQ,CAAC,MAAM,IAAI,OAAO,EAAE,CAAA;;AAC/E,gBAAA,IAAI,GAAG,CAAG,EAAA,QAAQ,CAAG,EAAA,IAAI,OAAO,CAAA;YAErC,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CACjD,UAAU,CAAC,CAAC,GAAG,KAAI;AACjB,gBAAA,IAAI,CAAC,QAAQ,C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