@o3r/localization 10.0.0-next.9 → 11.0.0-next.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 +12 -14
- package/annotations/index.d.ts +0 -1
- package/annotations/index.d.ts.map +1 -1
- package/annotations/localization.d.ts +0 -1
- package/annotations/localization.d.ts.map +1 -1
- package/builders/helpers/localization.generator.d.ts +6 -22
- package/builders/helpers/localization.generator.d.ts.map +1 -1
- package/builders/helpers/localization.generator.js +56 -57
- package/builders/helpers/localization.generator.js.map +1 -1
- package/builders/i18n/schema.json +1 -1
- package/builders/localization/index.d.ts.map +1 -1
- package/builders/localization/index.js +5 -4
- package/builders/localization/index.js.map +1 -1
- package/builders/localization/schema.json +1 -1
- package/builders/localization-extractor/index.d.ts.map +1 -1
- package/builders/localization-extractor/index.js +5 -3
- package/builders/localization-extractor/index.js.map +1 -1
- package/builders/localization-extractor/schema.d.ts +2 -0
- package/builders/localization-extractor/schema.d.ts.map +1 -1
- package/builders/localization-extractor/schema.json +6 -1
- package/core/localization.configuration.d.ts +8 -5
- package/core/localization.configuration.d.ts.map +1 -1
- package/core/translate-messageformat-lazy.compiler.d.ts +1 -3
- package/core/translate-messageformat-lazy.compiler.d.ts.map +1 -1
- package/devkit/localization-devkit.interface.d.ts +45 -2
- package/devkit/localization-devkit.interface.d.ts.map +1 -1
- package/devkit/localization-devtools.console.service.d.ts +38 -9
- package/devkit/localization-devtools.console.service.d.ts.map +1 -1
- package/devkit/localization-devtools.message.service.d.ts +4 -5
- package/devkit/localization-devtools.message.service.d.ts.map +1 -1
- package/devkit/localization-devtools.module.d.ts +0 -1
- package/devkit/localization-devtools.module.d.ts.map +1 -1
- package/devkit/localization-devtools.service.d.ts +11 -2
- package/devkit/localization-devtools.service.d.ts.map +1 -1
- package/devkit/localization-devtools.token.d.ts.map +1 -1
- package/esm2022/annotations/index.mjs +1 -2
- package/esm2022/annotations/localization.mjs +1 -2
- package/esm2022/core/localization.configuration.mjs +1 -1
- package/esm2022/core/translate-messageformat-lazy.compiler.mjs +6 -6
- package/esm2022/devkit/localization-devkit.interface.mjs +1 -1
- package/esm2022/devkit/localization-devtools.console.service.mjs +66 -12
- package/esm2022/devkit/localization-devtools.message.service.mjs +6 -7
- package/esm2022/devkit/localization-devtools.module.mjs +5 -6
- package/esm2022/devkit/localization-devtools.service.mjs +23 -6
- package/esm2022/devkit/localization-devtools.token.mjs +3 -2
- package/esm2022/rules-engine/localization.handler-action.mjs +30 -0
- package/esm2022/rules-engine/localization.interfaces.mjs +3 -0
- package/esm2022/rules-engine/localization.rules-engine.module.mjs +23 -0
- package/esm2022/rules-engine/o3r-localization-rules-engine.mjs +5 -0
- package/esm2022/rules-engine/public_api.mjs +4 -0
- package/esm2022/stores/localization-override/localization-override.module.mjs +4 -4
- package/esm2022/tools/localization-translate.directive.mjs +6 -7
- package/esm2022/tools/localization-translate.pipe.mjs +6 -7
- package/esm2022/tools/localization.module.mjs +9 -12
- package/esm2022/tools/localization.provider.mjs +1 -2
- package/esm2022/tools/localization.service.mjs +7 -14
- package/esm2022/tools/localized-currency.pipe.mjs +5 -5
- package/esm2022/tools/localized-date.pipe.mjs +5 -5
- package/esm2022/tools/localized-decimal.pipe.mjs +5 -5
- package/esm2022/tools/text-direction.service.mjs +6 -7
- package/esm2022/tools/text-directionality.service.mjs +6 -6
- package/esm2022/tools/translations-loader.mjs +9 -11
- package/fesm2022/o3r-localization-rules-engine.mjs +57 -0
- package/fesm2022/o3r-localization-rules-engine.mjs.map +1 -0
- package/fesm2022/o3r-localization.mjs +160 -139
- package/fesm2022/o3r-localization.mjs.map +1 -1
- package/package.json +40 -30
- package/rules-engine/index.d.ts +6 -0
- package/rules-engine/localization.handler-action.d.ts +19 -0
- package/rules-engine/localization.handler-action.d.ts.map +1 -0
- package/rules-engine/localization.interfaces.d.ts +12 -0
- package/rules-engine/localization.interfaces.d.ts.map +1 -0
- package/rules-engine/localization.rules-engine.module.d.ts +8 -0
- package/rules-engine/localization.rules-engine.module.d.ts.map +1 -0
- package/rules-engine/o3r-localization-rules-engine.d.ts.map +1 -0
- package/rules-engine/public_api.d.ts +4 -0
- package/rules-engine/public_api.d.ts.map +1 -0
- package/schemas/localization.metadata.schema.json +18 -3
- package/schemas/rules-engine.localisation-action.schema.json +26 -0
- package/schematics/add-localization-key/index.d.ts.map +1 -1
- package/schematics/add-localization-key/index.js +2 -2
- package/schematics/add-localization-key/index.js.map +1 -1
- package/schematics/add-localization-key/schema.json +1 -1
- package/schematics/cms-adapter/index.d.ts +0 -1
- package/schematics/cms-adapter/index.d.ts.map +1 -1
- package/schematics/cms-adapter/index.js +5 -9
- package/schematics/cms-adapter/index.js.map +1 -1
- package/schematics/localization-base/index.d.ts +2 -1
- package/schematics/localization-base/index.d.ts.map +1 -1
- package/schematics/localization-base/index.js +28 -34
- package/schematics/localization-base/index.js.map +1 -1
- package/schematics/localization-to-component/index.d.ts.map +1 -1
- package/schematics/localization-to-component/index.js +2 -2
- package/schematics/localization-to-component/index.js.map +1 -1
- package/schematics/localization-to-component/schema.json +1 -1
- package/schematics/ng-add/helpers/devtools-registration.d.ts +11 -0
- package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -0
- package/schematics/ng-add/helpers/devtools-registration.js +35 -0
- package/schematics/ng-add/helpers/devtools-registration.js.map +1 -0
- package/schematics/ng-add/index.d.ts +0 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +9 -5
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.json +1 -1
- package/tools/localization-translate.directive.d.ts +3 -4
- package/tools/localization-translate.directive.d.ts.map +1 -1
- package/tools/localization-translate.pipe.d.ts +4 -5
- package/tools/localization-translate.pipe.d.ts.map +1 -1
- package/tools/localization.module.d.ts +4 -7
- package/tools/localization.module.d.ts.map +1 -1
- package/tools/localization.provider.d.ts +0 -1
- package/tools/localization.provider.d.ts.map +1 -1
- package/tools/localization.service.d.ts +6 -14
- package/tools/localization.service.d.ts.map +1 -1
- package/tools/localized-currency.pipe.d.ts +6 -5
- package/tools/localized-currency.pipe.d.ts.map +1 -1
- package/tools/localized-date.pipe.d.ts +3 -3
- package/tools/localized-date.pipe.d.ts.map +1 -1
- package/tools/localized-decimal.pipe.d.ts +3 -3
- package/tools/localized-decimal.pipe.d.ts.map +1 -1
- package/tools/text-direction.service.d.ts +5 -6
- package/tools/text-direction.service.d.ts.map +1 -1
- package/tools/text-directionality.service.d.ts +0 -1
- package/tools/text-directionality.service.d.ts.map +1 -1
- package/tools/translations-loader.d.ts +5 -7
- package/tools/translations-loader.d.ts.map +1 -1
- package/annotations/input-merge.d.ts +0 -9
- package/annotations/input-merge.d.ts.map +0 -1
- package/builders/package.json +0 -3
- package/esm2022/annotations/input-merge.mjs +0 -29
- package/schematics/package.json +0 -3
|
@@ -4,12 +4,12 @@ import { InjectionToken, Injectable, Optional, Inject, NgModule, Directive, Inpu
|
|
|
4
4
|
import * as i2 from '@ngx-translate/core';
|
|
5
5
|
import { TranslateCompiler, TranslateDirective, TranslatePipe, TranslateModule, TranslateLoader } from '@ngx-translate/core';
|
|
6
6
|
import { IntlMessageFormat } from 'intl-messageformat';
|
|
7
|
+
import { BehaviorSubject, combineLatest, of, from, lastValueFrom, Subscription, fromEvent } from 'rxjs';
|
|
8
|
+
import { map, distinctUntilChanged, switchMap, shareReplay, startWith, catchError, take } from 'rxjs/operators';
|
|
7
9
|
import * as i3 from '@ngrx/store';
|
|
8
|
-
import {
|
|
10
|
+
import { props, createAction, on, createReducer, StoreModule, createFeatureSelector, createSelector, select } from '@ngrx/store';
|
|
9
11
|
import * as i1 from '@o3r/logger';
|
|
10
12
|
import { LoggerService } from '@o3r/logger';
|
|
11
|
-
import { BehaviorSubject, combineLatest, of, from, Subscription, fromEvent } from 'rxjs';
|
|
12
|
-
import { map, distinctUntilChanged, switchMap, shareReplay, startWith, catchError } from 'rxjs/operators';
|
|
13
13
|
import * as i2$1 from '@angular/cdk/bidi';
|
|
14
14
|
import { Directionality, DIR_DOCUMENT, BidiModule } from '@angular/cdk/bidi';
|
|
15
15
|
import { CurrencyPipe, DatePipe, DecimalPipe, CommonModule } from '@angular/common';
|
|
@@ -18,7 +18,6 @@ import { DynamicContentModule, DynamicContentService } from '@o3r/dynamic-conten
|
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* Decorator to pass localization url
|
|
21
|
-
*
|
|
22
21
|
* @param _url
|
|
23
22
|
*/
|
|
24
23
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
@@ -45,34 +44,6 @@ function Localization(_url) {
|
|
|
45
44
|
};
|
|
46
45
|
}
|
|
47
46
|
|
|
48
|
-
/**
|
|
49
|
-
* Decorator for @Input property
|
|
50
|
-
* It merges user input with default property value
|
|
51
|
-
*
|
|
52
|
-
* @param privateFieldName
|
|
53
|
-
* @deprecated will be removed in v10
|
|
54
|
-
*/
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
56
|
-
function InputMerge(privateFieldName) {
|
|
57
|
-
return (target, key) => {
|
|
58
|
-
const privateField = privateFieldName || `_${key}`;
|
|
59
|
-
const privateValue = target[key];
|
|
60
|
-
if (delete target[key]) {
|
|
61
|
-
Object.defineProperty(target, key, {
|
|
62
|
-
get: function () {
|
|
63
|
-
return this[privateField];
|
|
64
|
-
},
|
|
65
|
-
set: function (value) {
|
|
66
|
-
const currentField = this[privateField] || privateValue;
|
|
67
|
-
this[privateField] = typeof currentField === 'undefined' ? immutablePrimitive(value) : deepFill(currentField, value);
|
|
68
|
-
},
|
|
69
|
-
enumerable: true,
|
|
70
|
-
configurable: true
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
|
|
76
47
|
/**
|
|
77
48
|
* Default configuration for LocalizationModule
|
|
78
49
|
*/
|
|
@@ -140,17 +111,17 @@ class TranslateMessageFormatLazyCompiler extends TranslateCompiler {
|
|
|
140
111
|
return Object.keys(translations)
|
|
141
112
|
.reduce(compilingStrategy, {});
|
|
142
113
|
}
|
|
143
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
144
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
114
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslateMessageFormatLazyCompiler, deps: [{ token: MESSAGE_FORMAT_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
115
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslateMessageFormatLazyCompiler }); }
|
|
145
116
|
}
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslateMessageFormatLazyCompiler, decorators: [{
|
|
147
118
|
type: Injectable
|
|
148
|
-
}], ctorParameters:
|
|
119
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
149
120
|
type: Optional
|
|
150
121
|
}, {
|
|
151
122
|
type: Inject,
|
|
152
123
|
args: [MESSAGE_FORMAT_CONFIG]
|
|
153
|
-
}] }]
|
|
124
|
+
}] }] });
|
|
154
125
|
|
|
155
126
|
/** Actions */
|
|
156
127
|
const ACTION_SET = '[LocalizationOverride] set';
|
|
@@ -194,13 +165,13 @@ class LocalizationOverrideStoreModule {
|
|
|
194
165
|
]
|
|
195
166
|
};
|
|
196
167
|
}
|
|
197
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
198
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
199
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
168
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationOverrideStoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
169
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: LocalizationOverrideStoreModule, imports: [i3.StoreFeatureModule] }); }
|
|
170
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationOverrideStoreModule, providers: [
|
|
200
171
|
{ provide: LOCALIZATION_OVERRIDE_REDUCER_TOKEN, useFactory: getDefaultLocalizationOverrideReducer }
|
|
201
172
|
], imports: [StoreModule.forFeature(LOCALIZATION_OVERRIDE_STORE_NAME, LOCALIZATION_OVERRIDE_REDUCER_TOKEN)] }); }
|
|
202
173
|
}
|
|
203
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationOverrideStoreModule, decorators: [{
|
|
204
175
|
type: NgModule,
|
|
205
176
|
args: [{
|
|
206
177
|
imports: [
|
|
@@ -246,6 +217,7 @@ class LocalizationService {
|
|
|
246
217
|
/**
|
|
247
218
|
* Internal subject that we use to track changes between keys only and translation mode
|
|
248
219
|
*/
|
|
220
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
249
221
|
this._showKeys$ = new BehaviorSubject(false);
|
|
250
222
|
/**
|
|
251
223
|
* _showKeys$ exposed as an Observable
|
|
@@ -260,7 +232,6 @@ class LocalizationService {
|
|
|
260
232
|
* This will handle the fallback language hierarchy to find out fallback language.
|
|
261
233
|
* supportedLocales language has highest priority, next priority goes to fallbackLocalesMap and default would be
|
|
262
234
|
* fallbackLanguage.
|
|
263
|
-
*
|
|
264
235
|
* @param language Selected language.
|
|
265
236
|
* @returns selected language if supported, fallback language otherwise.
|
|
266
237
|
*/
|
|
@@ -287,7 +258,6 @@ class LocalizationService {
|
|
|
287
258
|
* supportedLocales: ['en-GB', 'en-US', 'fr-FR'], fallbackLocalesMap: {'en-CA': 'en-US', 'de': 'fr-FR'}
|
|
288
259
|
* translate to en-CA -> fallback to en-US, translate to de-DE -> fallback to fr-FR
|
|
289
260
|
* translate to en-NZ -> fallback to en-GB
|
|
290
|
-
*
|
|
291
261
|
* @param language Selected language.
|
|
292
262
|
* @returns Fallback language if available, undefined otherwise.
|
|
293
263
|
*/
|
|
@@ -301,7 +271,6 @@ class LocalizationService {
|
|
|
301
271
|
* supported language.
|
|
302
272
|
* supportedLocales: ['en-GB', 'en-US', 'fr-FR']
|
|
303
273
|
* translate to en-CA -> fallback to en-GB
|
|
304
|
-
*
|
|
305
274
|
* @param language Selected language.
|
|
306
275
|
* @returns Closest supported language if available, undefined otherwise.
|
|
307
276
|
*/
|
|
@@ -312,7 +281,6 @@ class LocalizationService {
|
|
|
312
281
|
}
|
|
313
282
|
/**
|
|
314
283
|
* Returns a stream of translated values of a key which updates whenever the language changes.
|
|
315
|
-
*
|
|
316
284
|
* @param translationKey Key to translate
|
|
317
285
|
* @param interpolateParams Object to use in translation binding
|
|
318
286
|
* @returns A stream of the translated key
|
|
@@ -344,7 +312,6 @@ class LocalizationService {
|
|
|
344
312
|
}
|
|
345
313
|
/**
|
|
346
314
|
* Wrapper to call the ngx-translate service TranslateService method use(language).
|
|
347
|
-
*
|
|
348
315
|
* @param language
|
|
349
316
|
*/
|
|
350
317
|
useLanguage(language) {
|
|
@@ -365,7 +332,6 @@ class LocalizationService {
|
|
|
365
332
|
}
|
|
366
333
|
/**
|
|
367
334
|
* Toggle the ShowKeys mode between active and inactive.
|
|
368
|
-
*
|
|
369
335
|
* @param value if specified, set the ShowKeys mode to value. If not specified, toggle the ShowKeys mode.
|
|
370
336
|
*/
|
|
371
337
|
toggleShowKeys(value) {
|
|
@@ -383,7 +349,6 @@ class LocalizationService {
|
|
|
383
349
|
}
|
|
384
350
|
/**
|
|
385
351
|
* Get an observable of translation key after global mapping
|
|
386
|
-
*
|
|
387
352
|
* @param requestedKey Original translation key
|
|
388
353
|
*/
|
|
389
354
|
getKey(requestedKey) {
|
|
@@ -396,7 +361,6 @@ class LocalizationService {
|
|
|
396
361
|
}
|
|
397
362
|
/**
|
|
398
363
|
* Returns a stream of translated values of a key which updates whenever the language changes.
|
|
399
|
-
*
|
|
400
364
|
* @param key Key to translate
|
|
401
365
|
* @param interpolateParams Object to use in translation binding
|
|
402
366
|
* @returns A stream of the translated key
|
|
@@ -404,17 +368,17 @@ class LocalizationService {
|
|
|
404
368
|
translate(key, interpolateParams) {
|
|
405
369
|
return this.getKey(key).pipe(switchMap((translationKey) => this.getTranslationStream(translationKey, interpolateParams)), shareReplay(1));
|
|
406
370
|
}
|
|
407
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
408
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
371
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationService, deps: [{ token: i2.TranslateService }, { token: i1.LoggerService }, { token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i3.Store, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
372
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationService }); }
|
|
409
373
|
}
|
|
410
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
374
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationService, decorators: [{
|
|
411
375
|
type: Injectable
|
|
412
|
-
}], ctorParameters:
|
|
376
|
+
}], ctorParameters: () => [{ type: i2.TranslateService }, { type: i1.LoggerService }, { type: undefined, decorators: [{
|
|
413
377
|
type: Inject,
|
|
414
378
|
args: [LOCALIZATION_CONFIGURATION_TOKEN]
|
|
415
379
|
}] }, { type: i3.Store, decorators: [{
|
|
416
380
|
type: Optional
|
|
417
|
-
}] }]
|
|
381
|
+
}] }] });
|
|
418
382
|
|
|
419
383
|
/**
|
|
420
384
|
* TranslateDirective class adding debug functionality
|
|
@@ -449,7 +413,6 @@ class LocalizationTranslateDirective extends TranslateDirective {
|
|
|
449
413
|
}
|
|
450
414
|
/**
|
|
451
415
|
* Overriding parent's setContent to plug debugging feature
|
|
452
|
-
*
|
|
453
416
|
* @param node
|
|
454
417
|
* @param content
|
|
455
418
|
*/
|
|
@@ -472,18 +435,18 @@ class LocalizationTranslateDirective extends TranslateDirective {
|
|
|
472
435
|
this.onKeyChange?.unsubscribe();
|
|
473
436
|
}
|
|
474
437
|
}
|
|
475
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
476
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
438
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationTranslateDirective, deps: [{ token: LocalizationService }, { token: i2.TranslateService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: LOCALIZATION_CONFIGURATION_TOKEN }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
439
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.8", type: LocalizationTranslateDirective, selector: "[translate],[ngx-translate]", inputs: { translate: "translate" }, usesInheritance: true, ngImport: i0 }); }
|
|
477
440
|
}
|
|
478
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
441
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationTranslateDirective, decorators: [{
|
|
479
442
|
type: Directive,
|
|
480
443
|
args: [{
|
|
481
444
|
selector: '[translate],[ngx-translate]'
|
|
482
445
|
}]
|
|
483
|
-
}], ctorParameters:
|
|
446
|
+
}], ctorParameters: () => [{ type: LocalizationService }, { type: i2.TranslateService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
484
447
|
type: Inject,
|
|
485
448
|
args: [LOCALIZATION_CONFIGURATION_TOKEN]
|
|
486
|
-
}] }]
|
|
449
|
+
}] }], propDecorators: { translate: [{
|
|
487
450
|
type: Input
|
|
488
451
|
}] } });
|
|
489
452
|
|
|
@@ -509,7 +472,6 @@ class LocalizationTranslatePipe extends TranslatePipe {
|
|
|
509
472
|
}
|
|
510
473
|
/**
|
|
511
474
|
* Calls original transform method and eventually outputs the key if debugMode (in LocalizationConfiguration) is enabled
|
|
512
|
-
*
|
|
513
475
|
* @inheritdoc
|
|
514
476
|
*/
|
|
515
477
|
transform(query, ...args) {
|
|
@@ -541,16 +503,16 @@ class LocalizationTranslatePipe extends TranslatePipe {
|
|
|
541
503
|
this.onShowKeysChange.unsubscribe();
|
|
542
504
|
}
|
|
543
505
|
}
|
|
544
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
545
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
506
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationTranslatePipe, deps: [{ token: LocalizationService }, { token: i2.TranslateService }, { token: i0.ChangeDetectorRef }, { token: LOCALIZATION_CONFIGURATION_TOKEN }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
507
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: LocalizationTranslatePipe, name: "translate", pure: false }); }
|
|
546
508
|
}
|
|
547
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
509
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationTranslatePipe, decorators: [{
|
|
548
510
|
type: Pipe,
|
|
549
511
|
args: [{ name: 'translate', pure: false }]
|
|
550
|
-
}], ctorParameters:
|
|
512
|
+
}], ctorParameters: () => [{ type: LocalizationService }, { type: i2.TranslateService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
551
513
|
type: Inject,
|
|
552
514
|
args: [LOCALIZATION_CONFIGURATION_TOKEN]
|
|
553
|
-
}] }]
|
|
515
|
+
}] }] });
|
|
554
516
|
|
|
555
517
|
/**
|
|
556
518
|
* Native angular CurrencyPipe taking the current lang into consideration
|
|
@@ -568,16 +530,16 @@ class LocalizedCurrencyPipe extends CurrencyPipe {
|
|
|
568
530
|
ngOnDestroy() {
|
|
569
531
|
this.onLangChange.unsubscribe();
|
|
570
532
|
}
|
|
571
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
572
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
533
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizedCurrencyPipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
534
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: LocalizedCurrencyPipe, name: "currency", pure: false }); }
|
|
573
535
|
}
|
|
574
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
536
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizedCurrencyPipe, decorators: [{
|
|
575
537
|
type: Pipe,
|
|
576
538
|
args: [{
|
|
577
539
|
name: 'currency',
|
|
578
540
|
pure: false
|
|
579
541
|
}]
|
|
580
|
-
}], ctorParameters:
|
|
542
|
+
}], ctorParameters: () => [{ type: LocalizationService }, { type: i0.ChangeDetectorRef }] });
|
|
581
543
|
|
|
582
544
|
/**
|
|
583
545
|
* Native angular DatePipe taking the current lang into consideration
|
|
@@ -600,16 +562,16 @@ class LocalizedDatePipe extends DatePipe {
|
|
|
600
562
|
ngOnDestroy() {
|
|
601
563
|
this.onLangChange.unsubscribe();
|
|
602
564
|
}
|
|
603
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
604
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
565
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizedDatePipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
566
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: LocalizedDatePipe, name: "date", pure: false }); }
|
|
605
567
|
}
|
|
606
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
568
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizedDatePipe, decorators: [{
|
|
607
569
|
type: Pipe,
|
|
608
570
|
args: [{
|
|
609
571
|
name: 'date',
|
|
610
572
|
pure: false
|
|
611
573
|
}]
|
|
612
|
-
}], ctorParameters:
|
|
574
|
+
}], ctorParameters: () => [{ type: LocalizationService }, { type: i0.ChangeDetectorRef }] });
|
|
613
575
|
|
|
614
576
|
/**
|
|
615
577
|
* Native angular DecimalPipe taking the current lang into consideration
|
|
@@ -627,16 +589,16 @@ class LocalizedDecimalPipe extends DecimalPipe {
|
|
|
627
589
|
ngOnDestroy() {
|
|
628
590
|
this.onLangChange.unsubscribe();
|
|
629
591
|
}
|
|
630
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
631
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
592
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizedDecimalPipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
593
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: LocalizedDecimalPipe, name: "decimal", pure: false }); }
|
|
632
594
|
}
|
|
633
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
595
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizedDecimalPipe, decorators: [{
|
|
634
596
|
type: Pipe,
|
|
635
597
|
args: [{
|
|
636
598
|
name: 'decimal',
|
|
637
599
|
pure: false
|
|
638
600
|
}]
|
|
639
|
-
}], ctorParameters:
|
|
601
|
+
}], ctorParameters: () => [{ type: LocalizationService }, { type: i0.ChangeDetectorRef }] });
|
|
640
602
|
|
|
641
603
|
/**
|
|
642
604
|
* Service for handling the text direction based on the LocalizationConfiguration
|
|
@@ -651,7 +613,6 @@ class TextDirectionService {
|
|
|
651
613
|
}
|
|
652
614
|
/**
|
|
653
615
|
* Updates the dir attribute on body HTML tag.
|
|
654
|
-
*
|
|
655
616
|
* @returns a subscription that updates the dir attribute
|
|
656
617
|
*/
|
|
657
618
|
onLangChangeSubscription() {
|
|
@@ -665,15 +626,15 @@ class TextDirectionService {
|
|
|
665
626
|
});
|
|
666
627
|
return this.subscription;
|
|
667
628
|
}
|
|
668
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
669
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
629
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TextDirectionService, deps: [{ token: i2.TranslateService }, { token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i0.RendererFactory2 }, { token: i2$1.Directionality }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
630
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TextDirectionService }); }
|
|
670
631
|
}
|
|
671
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
632
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TextDirectionService, decorators: [{
|
|
672
633
|
type: Injectable
|
|
673
|
-
}], ctorParameters:
|
|
634
|
+
}], ctorParameters: () => [{ type: i2.TranslateService }, { type: undefined, decorators: [{
|
|
674
635
|
type: Inject,
|
|
675
636
|
args: [LOCALIZATION_CONFIGURATION_TOKEN]
|
|
676
|
-
}] }, { type: i0.RendererFactory2 }, { type: i2$1.Directionality }]
|
|
637
|
+
}] }, { type: i0.RendererFactory2 }, { type: i2$1.Directionality }] });
|
|
677
638
|
|
|
678
639
|
class TextDirectionality extends Directionality {
|
|
679
640
|
constructor(_document) {
|
|
@@ -685,21 +646,20 @@ class TextDirectionality extends Directionality {
|
|
|
685
646
|
ngOnDestroy() {
|
|
686
647
|
this.change.complete();
|
|
687
648
|
}
|
|
688
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
689
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
649
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TextDirectionality, deps: [{ token: DIR_DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
650
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TextDirectionality }); }
|
|
690
651
|
}
|
|
691
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
652
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TextDirectionality, decorators: [{
|
|
692
653
|
type: Injectable
|
|
693
|
-
}], ctorParameters:
|
|
654
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
694
655
|
type: Optional
|
|
695
656
|
}, {
|
|
696
657
|
type: Inject,
|
|
697
658
|
args: [DIR_DOCUMENT]
|
|
698
|
-
}] }]
|
|
659
|
+
}] }] });
|
|
699
660
|
|
|
700
661
|
/**
|
|
701
662
|
* creates LocalizationConfiguration, which is used if the application
|
|
702
|
-
*
|
|
703
663
|
* @param configuration Localization configuration
|
|
704
664
|
*/
|
|
705
665
|
function createLocalizationConfiguration(configuration) {
|
|
@@ -710,7 +670,6 @@ function createLocalizationConfiguration(configuration) {
|
|
|
710
670
|
}
|
|
711
671
|
/**
|
|
712
672
|
* Factory to inject the LOCALE_ID token with the current language into Angular context
|
|
713
|
-
*
|
|
714
673
|
* @param localizationService Localization service
|
|
715
674
|
*/
|
|
716
675
|
function localeIdNgBridge(localizationService) {
|
|
@@ -722,11 +681,10 @@ class LocalizationModule {
|
|
|
722
681
|
/**
|
|
723
682
|
* forRoot method should be called only once from the application index.ts
|
|
724
683
|
* It will do several things:
|
|
725
|
-
*
|
|
726
|
-
*
|
|
727
|
-
*
|
|
728
|
-
*
|
|
729
|
-
*
|
|
684
|
+
* - provide the configuration for the whole application
|
|
685
|
+
* - register all locales specified in the LocalizationConfiguration
|
|
686
|
+
* - configure TranslateService
|
|
687
|
+
* - inject LOCALE_ID token
|
|
730
688
|
* @param configuration LocalizationConfiguration
|
|
731
689
|
*/
|
|
732
690
|
static forRoot(configuration) {
|
|
@@ -741,9 +699,9 @@ class LocalizationModule {
|
|
|
741
699
|
]
|
|
742
700
|
};
|
|
743
701
|
}
|
|
744
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
745
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
746
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
702
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
703
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: LocalizationModule, declarations: [LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule], exports: [TranslateModule, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe] }); }
|
|
704
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationModule, providers: [
|
|
747
705
|
{ provide: LOCALIZATION_CONFIGURATION_TOKEN, useFactory: createLocalizationConfiguration, deps: [[new Optional(), CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN]] },
|
|
748
706
|
{ provide: LOCALE_ID, useFactory: localeIdNgBridge, deps: [LocalizationService] },
|
|
749
707
|
{ provide: Directionality, useClass: TextDirectionality },
|
|
@@ -753,7 +711,7 @@ class LocalizationModule {
|
|
|
753
711
|
TextDirectionService
|
|
754
712
|
], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule, TranslateModule] }); }
|
|
755
713
|
}
|
|
756
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
714
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
757
715
|
type: NgModule,
|
|
758
716
|
args: [{
|
|
759
717
|
declarations: [LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe],
|
|
@@ -786,7 +744,6 @@ class TranslationsLoader {
|
|
|
786
744
|
}
|
|
787
745
|
/**
|
|
788
746
|
* Download a language bundle file
|
|
789
|
-
*
|
|
790
747
|
* @param url Url to the bundle file
|
|
791
748
|
*/
|
|
792
749
|
downloadLanguageBundle$(url) {
|
|
@@ -841,11 +798,10 @@ class TranslationsLoader {
|
|
|
841
798
|
}
|
|
842
799
|
/**
|
|
843
800
|
*
|
|
844
|
-
*
|
|
845
|
-
*
|
|
846
|
-
* 1. try to load lang from local
|
|
847
|
-
* 2. if 1 fails try to load fallback lang but only if it's different from lang in 1
|
|
801
|
+
*Fetches localization bundles from published folder (internal to application)
|
|
848
802
|
*
|
|
803
|
+
*1. try to load lang from local
|
|
804
|
+
*2. if 1 fails try to load fallback lang but only if it's different from lang in 1
|
|
849
805
|
* @param lang - language of the bundle
|
|
850
806
|
* @param fallbackLanguage - fallback language in case bundle in language not found
|
|
851
807
|
*/
|
|
@@ -862,24 +818,23 @@ class TranslationsLoader {
|
|
|
862
818
|
}
|
|
863
819
|
}));
|
|
864
820
|
}
|
|
865
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
866
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
821
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationsLoader, deps: [{ token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i1.LoggerService, optional: true }, { token: i2$2.DynamicContentService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
822
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationsLoader }); }
|
|
867
823
|
}
|
|
868
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
824
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: TranslationsLoader, decorators: [{
|
|
869
825
|
type: Injectable
|
|
870
|
-
}], ctorParameters:
|
|
826
|
+
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
871
827
|
type: Inject,
|
|
872
828
|
args: [LOCALIZATION_CONFIGURATION_TOKEN]
|
|
873
829
|
}] }, { type: i1.LoggerService, decorators: [{
|
|
874
830
|
type: Optional
|
|
875
831
|
}] }, { type: i2$2.DynamicContentService, decorators: [{
|
|
876
832
|
type: Optional
|
|
877
|
-
}] }]
|
|
833
|
+
}] }] });
|
|
878
834
|
|
|
879
835
|
/**
|
|
880
836
|
* Creates a loader of translations bundles based on the configuration
|
|
881
837
|
* (endPointUrl and language determine which bundle we load and where do we fetch it from)
|
|
882
|
-
*
|
|
883
838
|
* @param localizationConfiguration
|
|
884
839
|
* @param logger service to handle the log of warning and errors
|
|
885
840
|
* @param dynamicContentService (optional)
|
|
@@ -902,21 +857,39 @@ class OtterLocalizationDevtools {
|
|
|
902
857
|
}
|
|
903
858
|
/**
|
|
904
859
|
* Show localization keys
|
|
905
|
-
*
|
|
906
860
|
* @param value value enforced by the DevTools extension
|
|
907
861
|
*/
|
|
908
862
|
showLocalizationKeys(value) {
|
|
909
863
|
this.localizationService.toggleShowKeys(value);
|
|
910
864
|
}
|
|
911
|
-
/**
|
|
912
|
-
|
|
865
|
+
/**
|
|
866
|
+
* Returns the current language
|
|
867
|
+
*/
|
|
868
|
+
getCurrentLanguage() {
|
|
869
|
+
return this.localizationService.getCurrentLanguage();
|
|
870
|
+
}
|
|
871
|
+
/**
|
|
872
|
+
* Setup a listener on language change
|
|
873
|
+
* @param fn called when the language is changed in the app
|
|
874
|
+
*/
|
|
875
|
+
onLanguageChange(fn) {
|
|
876
|
+
return this.localizationService
|
|
877
|
+
.getTranslateService()
|
|
878
|
+
.onLangChange
|
|
879
|
+
.subscribe(({ lang }) => {
|
|
880
|
+
fn(lang);
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: OtterLocalizationDevtools, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
884
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: OtterLocalizationDevtools }); }
|
|
913
885
|
}
|
|
914
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
886
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: OtterLocalizationDevtools, decorators: [{
|
|
915
887
|
type: Injectable
|
|
916
|
-
}], ctorParameters:
|
|
888
|
+
}], ctorParameters: () => [{ type: LocalizationService }] });
|
|
917
889
|
|
|
918
890
|
const OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS = {
|
|
919
|
-
isActivatedOnBootstrap: false
|
|
891
|
+
isActivatedOnBootstrap: false,
|
|
892
|
+
isActivatedOnBootstrapWhenCMSContext: true
|
|
920
893
|
};
|
|
921
894
|
const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS = new InjectionToken('Otter Localization Devtools options');
|
|
922
895
|
|
|
@@ -924,10 +897,14 @@ const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS = new InjectionToken('Otter Localizati
|
|
|
924
897
|
class LocalizationDevtoolsConsoleService {
|
|
925
898
|
/** Name of the Window property to access to the devtools */
|
|
926
899
|
static { this.windowModuleName = 'localization'; }
|
|
927
|
-
constructor(localizationDevtools, options = OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS) {
|
|
900
|
+
constructor(localizationDevtools, localizationService, appRef, options = OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS) {
|
|
928
901
|
this.localizationDevtools = localizationDevtools;
|
|
902
|
+
this.localizationService = localizationService;
|
|
903
|
+
this.appRef = appRef;
|
|
929
904
|
this.options = options;
|
|
930
|
-
if (this.options.isActivatedOnBootstrap
|
|
905
|
+
if (this.options.isActivatedOnBootstrap
|
|
906
|
+
|| (this.options.isActivatedOnBootstrapWhenCMSContext
|
|
907
|
+
&& document.body.dataset.cmscontext === 'true')) {
|
|
931
908
|
this.activate();
|
|
932
909
|
}
|
|
933
910
|
}
|
|
@@ -941,24 +918,70 @@ class LocalizationDevtoolsConsoleService {
|
|
|
941
918
|
console.info(`Otter localization Devtools is now accessible via the _OTTER_DEVTOOLS_.${LocalizationDevtoolsConsoleService.windowModuleName} variable`);
|
|
942
919
|
}
|
|
943
920
|
/**
|
|
944
|
-
*
|
|
945
|
-
*
|
|
946
|
-
* @param value value enforced by the DevTools extension
|
|
921
|
+
* @inheritdoc
|
|
947
922
|
*/
|
|
948
923
|
showLocalizationKeys(value) {
|
|
949
924
|
this.localizationDevtools.showLocalizationKeys(value);
|
|
925
|
+
this.appRef.tick();
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* @inheritdoc
|
|
929
|
+
*/
|
|
930
|
+
getCurrentLanguage() {
|
|
931
|
+
const currentLanguage = this.localizationDevtools.getCurrentLanguage();
|
|
932
|
+
return currentLanguage;
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* @inheritdoc
|
|
936
|
+
*/
|
|
937
|
+
async switchLanguage(language) {
|
|
938
|
+
const previous = this.localizationDevtools.getCurrentLanguage();
|
|
939
|
+
await lastValueFrom(this.localizationService.useLanguage(language));
|
|
940
|
+
this.appRef.tick();
|
|
941
|
+
const current = this.localizationDevtools.getCurrentLanguage();
|
|
942
|
+
return {
|
|
943
|
+
requested: language,
|
|
944
|
+
previous,
|
|
945
|
+
current
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* @inheritdoc
|
|
950
|
+
*/
|
|
951
|
+
onLanguageChange(fn) {
|
|
952
|
+
return this.localizationDevtools.onLanguageChange(fn);
|
|
950
953
|
}
|
|
951
|
-
/**
|
|
952
|
-
|
|
954
|
+
/**
|
|
955
|
+
* @inheritdoc
|
|
956
|
+
*/
|
|
957
|
+
updateLocalizationKeys(keyValues, language) {
|
|
958
|
+
Object.entries(keyValues).map(([key, value]) => {
|
|
959
|
+
this.localizationService.getTranslateService().set(key, value, language || this.localizationDevtools.getCurrentLanguage());
|
|
960
|
+
});
|
|
961
|
+
this.appRef.tick();
|
|
962
|
+
}
|
|
963
|
+
/**
|
|
964
|
+
* @inheritdoc
|
|
965
|
+
*/
|
|
966
|
+
async reloadLocalizationKeys(language) {
|
|
967
|
+
const lang = language || this.localizationDevtools.getCurrentLanguage();
|
|
968
|
+
const initialLocs = await lastValueFrom(this.localizationService
|
|
969
|
+
.getTranslateService()
|
|
970
|
+
.reloadLang(lang)
|
|
971
|
+
.pipe(take(1)));
|
|
972
|
+
return this.updateLocalizationKeys(initialLocs, lang);
|
|
973
|
+
}
|
|
974
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsConsoleService, deps: [{ token: OtterLocalizationDevtools }, { token: LocalizationService }, { token: i0.ApplicationRef }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
975
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsConsoleService }); }
|
|
953
976
|
}
|
|
954
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
977
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsConsoleService, decorators: [{
|
|
955
978
|
type: Injectable
|
|
956
|
-
}], ctorParameters:
|
|
979
|
+
}], ctorParameters: () => [{ type: OtterLocalizationDevtools }, { type: LocalizationService }, { type: i0.ApplicationRef }, { type: undefined, decorators: [{
|
|
957
980
|
type: Optional
|
|
958
981
|
}, {
|
|
959
982
|
type: Inject,
|
|
960
983
|
args: [OTTER_LOCALIZATION_DEVTOOLS_OPTIONS]
|
|
961
|
-
}] }]
|
|
984
|
+
}] }] });
|
|
962
985
|
|
|
963
986
|
const isLocalizationMessage = (message) => {
|
|
964
987
|
return message && message.dataType === 'displayLocalizationKeys';
|
|
@@ -975,7 +998,6 @@ class LocalizationDevtoolsMessageService {
|
|
|
975
998
|
}
|
|
976
999
|
/**
|
|
977
1000
|
* Function to handle the incoming messages from Otter Chrome DevTools extension
|
|
978
|
-
*
|
|
979
1001
|
* @param event Event coming from the Otter Chrome DevTools extension
|
|
980
1002
|
* @param message
|
|
981
1003
|
*/
|
|
@@ -1009,22 +1031,21 @@ class LocalizationDevtoolsMessageService {
|
|
|
1009
1031
|
ngOnDestroy() {
|
|
1010
1032
|
this.subscriptions.unsubscribe();
|
|
1011
1033
|
}
|
|
1012
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1013
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1034
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsMessageService, deps: [{ token: i1.LoggerService }, { token: OtterLocalizationDevtools }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1035
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsMessageService }); }
|
|
1014
1036
|
}
|
|
1015
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1037
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsMessageService, decorators: [{
|
|
1016
1038
|
type: Injectable
|
|
1017
|
-
}], ctorParameters:
|
|
1039
|
+
}], ctorParameters: () => [{ type: i1.LoggerService }, { type: OtterLocalizationDevtools }, { type: undefined, decorators: [{
|
|
1018
1040
|
type: Optional
|
|
1019
1041
|
}, {
|
|
1020
1042
|
type: Inject,
|
|
1021
1043
|
args: [OTTER_LOCALIZATION_DEVTOOLS_OPTIONS]
|
|
1022
|
-
}] }]
|
|
1044
|
+
}] }] });
|
|
1023
1045
|
|
|
1024
1046
|
class LocalizationDevtoolsModule {
|
|
1025
1047
|
/**
|
|
1026
1048
|
* Initialize Otter Devtools
|
|
1027
|
-
*
|
|
1028
1049
|
* @param options
|
|
1029
1050
|
*/
|
|
1030
1051
|
static instrument(options) {
|
|
@@ -1038,16 +1059,16 @@ class LocalizationDevtoolsModule {
|
|
|
1038
1059
|
]
|
|
1039
1060
|
};
|
|
1040
1061
|
}
|
|
1041
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1042
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
1043
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
1062
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1063
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsModule, imports: [LocalizationModule] }); }
|
|
1064
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsModule, providers: [
|
|
1044
1065
|
{ provide: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, useValue: OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS },
|
|
1045
1066
|
LocalizationDevtoolsMessageService,
|
|
1046
1067
|
LocalizationDevtoolsConsoleService,
|
|
1047
1068
|
OtterLocalizationDevtools
|
|
1048
1069
|
], imports: [LocalizationModule] }); }
|
|
1049
1070
|
}
|
|
1050
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImport: i0, type: LocalizationDevtoolsModule, decorators: [{
|
|
1051
1072
|
type: NgModule,
|
|
1052
1073
|
args: [{
|
|
1053
1074
|
imports: [
|
|
@@ -1066,5 +1087,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.0", ngImpor
|
|
|
1066
1087
|
* Generated bundle index. Do not edit.
|
|
1067
1088
|
*/
|
|
1068
1089
|
|
|
1069
|
-
export { CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN, DEFAULT_LOCALIZATION_CONFIGURATION,
|
|
1090
|
+
export { CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN, DEFAULT_LOCALIZATION_CONFIGURATION, LOCALIZATION_CONFIGURATION_TOKEN, LOCALIZATION_OVERRIDE_REDUCER_TOKEN, LOCALIZATION_OVERRIDE_STORE_NAME, Localization, LocalizationDevtoolsConsoleService, LocalizationDevtoolsMessageService, LocalizationDevtoolsModule, LocalizationModule, LocalizationOverrideStoreModule, LocalizationService, LocalizationTranslateDirective, LocalizationTranslatePipe, LocalizedCurrencyPipe, LocalizedDatePipe, LocalizedDecimalPipe, MESSAGE_FORMAT_CONFIG, OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS, OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, OtterLocalizationDevtools, TextDirectionService, TextDirectionality, TranslateMessageFormatLazyCompiler, TranslationsLoader, createLocalizationConfiguration, createTranslateLoader, getDefaultLocalizationOverrideReducer, lazyMessageDefaultConfig, localeIdNgBridge, localizationOverrideInitialState, localizationOverrideReducer, localizationOverrideReducerFeatures, localizationOverrideStorageDeserializer, localizationOverrideStorageSync, selectLocalizationOverride, selectLocalizationOverrideState, setLocalizationOverride, translateLoaderProvider };
|
|
1070
1091
|
//# sourceMappingURL=o3r-localization.mjs.map
|