@o3r/localization 11.6.0-prerelease.4 → 11.6.0-prerelease.40
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/annotations/localization.d.ts.map +1 -1
- package/builders/helpers/localization.generator.d.ts +1 -1
- package/builders/helpers/localization.generator.d.ts.map +1 -1
- package/builders/helpers/localization.generator.js +20 -22
- package/builders/i18n/index.d.ts.map +1 -1
- package/builders/i18n/index.js +2 -2
- package/builders/i18n/schema.d.ts +0 -2
- package/builders/i18n/schema.d.ts.map +1 -1
- package/builders/localization/index.d.ts +0 -2
- package/builders/localization/index.d.ts.map +1 -1
- package/builders/localization/index.js +28 -41
- package/builders/localization/schema.d.ts.map +1 -1
- package/builders/localization-extractor/index.d.ts.map +1 -1
- package/builders/localization-extractor/index.js +19 -19
- package/builders/localization-extractor/schema.d.ts.map +1 -1
- package/builders/localization-extractor/validations.d.ts +0 -2
- package/builders/localization-extractor/validations.d.ts.map +1 -1
- package/builders/localization-extractor/validations.js +3 -7
- package/builders/metadata-check/helpers/localization-metadata-comparison.helper.d.ts +2 -2
- package/builders/metadata-check/helpers/localization-metadata-comparison.helper.d.ts.map +1 -1
- package/builders/metadata-check/index.d.ts.map +1 -1
- package/builders/metadata-check/schema.d.ts.map +1 -1
- package/core/localization.configuration.d.ts +1 -1
- package/core/localization.configuration.d.ts.map +1 -1
- package/core/translatable.d.ts.map +1 -1
- package/core/translate-messageformat-lazy.compiler.d.ts +1 -1
- package/core/translate-messageformat-lazy.compiler.d.ts.map +1 -1
- package/devkit/localization-devkit.interface.d.ts.map +1 -1
- package/devkit/localization-devtools.console.service.d.ts.map +1 -1
- package/devkit/localization-devtools.message.service.d.ts +3 -7
- package/devkit/localization-devtools.message.service.d.ts.map +1 -1
- package/devkit/localization-devtools.module.d.ts.map +1 -1
- package/devkit/localization-devtools.service.d.ts.map +1 -1
- package/devkit/localization-devtools.token.d.ts +1 -1
- package/devkit/localization-devtools.token.d.ts.map +1 -1
- package/esm2022/annotations/localization.mjs +3 -3
- package/esm2022/core/index.mjs +1 -1
- package/esm2022/core/localization.configuration.mjs +1 -1
- package/esm2022/core/translatable.mjs +1 -1
- package/esm2022/core/translate-messageformat-lazy.compiler.mjs +12 -13
- package/esm2022/devkit/index.mjs +1 -1
- package/esm2022/devkit/localization-devkit.interface.mjs +1 -1
- package/esm2022/devkit/localization-devtools.console.service.mjs +8 -10
- package/esm2022/devkit/localization-devtools.message.service.mjs +15 -19
- package/esm2022/devkit/localization-devtools.module.mjs +11 -11
- package/esm2022/devkit/localization-devtools.service.mjs +8 -8
- package/esm2022/devkit/localization-devtools.token.mjs +2 -2
- package/esm2022/public_api.mjs +1 -2
- package/esm2022/rules-engine/localization.handler-action.mjs +8 -8
- package/esm2022/rules-engine/localization.interfaces.mjs +1 -1
- package/esm2022/rules-engine/localization.rules-engine.module.mjs +8 -8
- package/esm2022/stores/index.mjs +1 -1
- package/esm2022/stores/localization-override/localization-override.actions.mjs +2 -2
- package/esm2022/stores/localization-override/localization-override.module.mjs +9 -9
- package/esm2022/stores/localization-override/localization-override.reducer.mjs +2 -2
- package/esm2022/stores/localization-override/localization-override.selectors.mjs +3 -3
- package/esm2022/stores/localization-override/localization-override.state.mjs +1 -1
- package/esm2022/stores/localization-override/localization-override.sync.mjs +2 -2
- package/esm2022/tools/index.mjs +1 -1
- package/esm2022/tools/localization-translate.directive.mjs +9 -9
- package/esm2022/tools/localization-translate.pipe.mjs +11 -11
- package/esm2022/tools/localization.module.mjs +27 -25
- package/esm2022/tools/localization.provider.mjs +7 -7
- package/esm2022/tools/localization.service.mjs +20 -25
- package/esm2022/tools/localization.token.mjs +2 -2
- package/esm2022/tools/localized-currency.pipe.mjs +7 -7
- package/esm2022/tools/localized-date.pipe.mjs +8 -13
- package/esm2022/tools/localized-decimal.pipe.mjs +7 -7
- package/esm2022/tools/text-direction.service.mjs +9 -9
- package/esm2022/tools/text-directionality.service.mjs +7 -7
- package/esm2022/tools/translations-loader.mjs +16 -16
- package/fesm2022/o3r-localization-rules-engine.mjs +7 -7
- package/fesm2022/o3r-localization-rules-engine.mjs.map +1 -1
- package/fesm2022/o3r-localization.mjs +91 -106
- package/fesm2022/o3r-localization.mjs.map +1 -1
- package/migration.json +5 -0
- package/package.json +19 -19
- package/public_api.d.ts +0 -1
- package/public_api.d.ts.map +1 -1
- package/rules-engine/localization.handler-action.d.ts +1 -1
- package/rules-engine/localization.handler-action.d.ts.map +1 -1
- package/rules-engine/localization.interfaces.d.ts.map +1 -1
- package/rules-engine/localization.rules-engine.module.d.ts.map +1 -1
- package/schematics/add-localization-key/index.d.ts.map +1 -1
- package/schematics/add-localization-key/index.js +34 -16
- package/schematics/add-localization-key/schema.d.ts.map +1 -1
- package/schematics/cms-adapter/index.d.ts.map +1 -1
- package/schematics/cms-adapter/index.js +1 -1
- package/schematics/localization-base/index.d.ts.map +1 -1
- package/schematics/localization-base/index.js +25 -26
- package/schematics/localization-to-component/index.d.ts.map +1 -1
- package/schematics/localization-to-component/index.js +10 -5
- package/schematics/localization-to-component/schema.d.ts.map +1 -1
- package/schematics/localization-to-component/templates/__name__.translation.ts.template +1 -1
- package/schematics/ng-add/helpers/devtools-registration.d.ts +0 -3
- package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -1
- package/schematics/ng-add/helpers/devtools-registration.js +2 -5
- package/schematics/ng-add/helpers/devtools-registration.js.map +1 -0
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +2 -8
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.d.ts.map +1 -1
- package/schematics/ng-update/v10-0/index.d.ts.map +1 -1
- package/schematics/ng-update/v10-0/index.js +2 -1
- package/schematics/ng-update/v11-6/index.d.ts +6 -0
- package/schematics/ng-update/v11-6/index.d.ts.map +1 -0
- package/schematics/ng-update/v11-6/index.js +22 -0
- package/stores/localization-override/localization-override.actions.d.ts.map +1 -1
- package/stores/localization-override/localization-override.module.d.ts.map +1 -1
- package/stores/localization-override/localization-override.reducer.d.ts.map +1 -1
- package/stores/localization-override/localization-override.selectors.d.ts.map +1 -1
- package/stores/localization-override/localization-override.state.d.ts.map +1 -1
- package/stores/localization-override/localization-override.sync.d.ts.map +1 -1
- package/tools/localization-translate.directive.d.ts.map +1 -1
- package/tools/localization-translate.pipe.d.ts.map +1 -1
- package/tools/localization.module.d.ts.map +1 -1
- package/tools/localization.provider.d.ts +1 -1
- package/tools/localization.provider.d.ts.map +1 -1
- package/tools/localization.service.d.ts.map +1 -1
- package/tools/localization.token.d.ts.map +1 -1
- package/tools/localized-currency.pipe.d.ts.map +1 -1
- package/tools/localized-date.pipe.d.ts.map +1 -1
- package/tools/localized-decimal.pipe.d.ts.map +1 -1
- package/tools/text-direction.service.d.ts.map +1 -1
- package/tools/text-directionality.service.d.ts.map +1 -1
- package/tools/translations-loader.d.ts +2 -2
- package/tools/translations-loader.d.ts.map +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { immutablePrimitive, deepFill, otterComponentInfoPropertyName, sendOtterMessage, filterMessageContent } from '@o3r/core';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, Injectable, Optional, Inject, NgModule, Directive, Input, Pipe, LOCALE_ID } from '@angular/core';
|
|
3
|
+
import { InjectionToken, Injectable, Optional, Inject, NgModule, Directive, Input, Pipe, LOCALE_ID, inject, DestroyRef } from '@angular/core';
|
|
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, firstValueFrom,
|
|
7
|
+
import { BehaviorSubject, combineLatest, of, from, lastValueFrom, firstValueFrom, fromEvent } from 'rxjs';
|
|
8
8
|
import * as i3 from '@ngrx/store';
|
|
9
9
|
import { createAction, props, on, createReducer, StoreModule, createFeatureSelector, createSelector, select } from '@ngrx/store';
|
|
10
10
|
import * as i1 from '@o3r/logger';
|
|
@@ -15,12 +15,13 @@ import { Directionality, DIR_DOCUMENT, BidiModule } from '@angular/cdk/bidi';
|
|
|
15
15
|
import { CurrencyPipe, DatePipe, DecimalPipe, CommonModule } from '@angular/common';
|
|
16
16
|
import * as i2$2 from '@o3r/dynamic-content';
|
|
17
17
|
import { DynamicContentModule, DynamicContentService } from '@o3r/dynamic-content';
|
|
18
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Decorator to pass localization url
|
|
21
22
|
* @param _url
|
|
22
23
|
*/
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention -- decorator should start with a capital letter
|
|
24
25
|
function Localization(_url) {
|
|
25
26
|
return (target, key) => {
|
|
26
27
|
const privateField = _url || `_${key}`;
|
|
@@ -91,8 +92,8 @@ class TranslateMessageFormatLazyCompiler extends TranslateCompiler {
|
|
|
91
92
|
}
|
|
92
93
|
/** @inheritDoc */
|
|
93
94
|
compileTranslations(translations, lang) {
|
|
94
|
-
const compilingStrategy = this.config.enableCache
|
|
95
|
-
(acc, key) => {
|
|
95
|
+
const compilingStrategy = this.config.enableCache
|
|
96
|
+
? (acc, key) => {
|
|
96
97
|
acc[key] = (params) => {
|
|
97
98
|
const cached = this.cache[`${lang}_${key}`];
|
|
98
99
|
if (cached) {
|
|
@@ -103,18 +104,17 @@ class TranslateMessageFormatLazyCompiler extends TranslateCompiler {
|
|
|
103
104
|
return newCachedItem.format(params);
|
|
104
105
|
};
|
|
105
106
|
return acc;
|
|
106
|
-
}
|
|
107
|
-
(acc, key) => {
|
|
107
|
+
}
|
|
108
|
+
: (acc, key) => {
|
|
108
109
|
acc[key] = (params) => new IntlMessageFormat(translations[key], lang, undefined, this.config).format(params);
|
|
109
110
|
return acc;
|
|
110
111
|
};
|
|
111
|
-
return Object.keys(translations)
|
|
112
|
-
.reduce(compilingStrategy, {});
|
|
112
|
+
return Object.keys(translations).reduce((acc, key) => compilingStrategy(acc, key), {});
|
|
113
113
|
}
|
|
114
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
115
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
114
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", 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: "18.2.13", ngImport: i0, type: TranslateMessageFormatLazyCompiler }); }
|
|
116
116
|
}
|
|
117
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TranslateMessageFormatLazyCompiler, decorators: [{
|
|
118
118
|
type: Injectable
|
|
119
119
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
120
120
|
type: Optional
|
|
@@ -165,13 +165,13 @@ class LocalizationOverrideStoreModule {
|
|
|
165
165
|
]
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
169
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.
|
|
170
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.
|
|
168
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationOverrideStoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
169
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LocalizationOverrideStoreModule, imports: [i3.StoreFeatureModule] }); }
|
|
170
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationOverrideStoreModule, providers: [
|
|
171
171
|
{ provide: LOCALIZATION_OVERRIDE_REDUCER_TOKEN, useFactory: getDefaultLocalizationOverrideReducer }
|
|
172
172
|
], imports: [StoreModule.forFeature(LOCALIZATION_OVERRIDE_STORE_NAME, LOCALIZATION_OVERRIDE_REDUCER_TOKEN)] }); }
|
|
173
173
|
}
|
|
174
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationOverrideStoreModule, decorators: [{
|
|
175
175
|
type: NgModule,
|
|
176
176
|
args: [{
|
|
177
177
|
imports: [
|
|
@@ -201,7 +201,6 @@ const localizationOverrideStorageSync = {
|
|
|
201
201
|
/** Localization Configuration Token */
|
|
202
202
|
const LOCALIZATION_CONFIGURATION_TOKEN = new InjectionToken('Localization Configuration injection token');
|
|
203
203
|
|
|
204
|
-
/* eslint-disable @typescript-eslint/ban-types */
|
|
205
204
|
/**
|
|
206
205
|
* Service which is wrapping the configuration logic of TranslateService from ngx-translate
|
|
207
206
|
* Any application willing to use localization just needs to inject LocalizationService
|
|
@@ -217,7 +216,6 @@ class LocalizationService {
|
|
|
217
216
|
/**
|
|
218
217
|
* Internal subject that we use to track changes between keys only and translation mode
|
|
219
218
|
*/
|
|
220
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
221
219
|
this._showKeys$ = new BehaviorSubject(false);
|
|
222
220
|
/**
|
|
223
221
|
* _showKeys$ exposed as an Observable
|
|
@@ -236,12 +234,12 @@ class LocalizationService {
|
|
|
236
234
|
* @returns selected language if supported, fallback language otherwise.
|
|
237
235
|
*/
|
|
238
236
|
checkFallbackLocalesMap(language) {
|
|
239
|
-
if (language && this.configuration.supportedLocales.
|
|
237
|
+
if (language && !this.configuration.supportedLocales.includes(language)) {
|
|
240
238
|
const closestSupportedLanguageCode = this.getFirstClosestSupportedLanguageCode(language);
|
|
241
239
|
const fallbackForLanguage = this.getFallbackMapLangCode(language);
|
|
242
|
-
const fallbackStrategyDebug = fallbackForLanguage && ' associated fallback language '
|
|
243
|
-
closestSupportedLanguageCode && ' closest supported language '
|
|
244
|
-
this.configuration.fallbackLanguage && ' configured default language ';
|
|
240
|
+
const fallbackStrategyDebug = (fallbackForLanguage && ' associated fallback language ')
|
|
241
|
+
|| (closestSupportedLanguageCode && ' closest supported language ')
|
|
242
|
+
|| (this.configuration.fallbackLanguage && ' configured default language ');
|
|
245
243
|
const fallbackLang = fallbackForLanguage || closestSupportedLanguageCode || this.configuration.fallbackLanguage || language;
|
|
246
244
|
if (language !== fallbackLang) {
|
|
247
245
|
this.logger.debug(`Non supported languages ${language} will fallback to ${fallbackStrategyDebug} ${fallbackLang}`);
|
|
@@ -344,7 +342,7 @@ class LocalizationService {
|
|
|
344
342
|
if (!this.configuration.enableTranslationDeactivation) {
|
|
345
343
|
throw new Error('Translation deactivation is not enabled. Please set the LocalizationConfiguration property "enableTranslationDeactivation" accordingly.');
|
|
346
344
|
}
|
|
347
|
-
const newValue = value
|
|
345
|
+
const newValue = value === undefined ? !this.showKeys : value;
|
|
348
346
|
this._showKeys$.next(newValue);
|
|
349
347
|
}
|
|
350
348
|
/**
|
|
@@ -358,12 +356,9 @@ class LocalizationService {
|
|
|
358
356
|
* @param requestedKey Original translation key
|
|
359
357
|
*/
|
|
360
358
|
getKey(requestedKey) {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
else {
|
|
365
|
-
return of(requestedKey);
|
|
366
|
-
}
|
|
359
|
+
return this.keyMapping$
|
|
360
|
+
? this.keyMapping$.pipe(map((keyMapping) => keyMapping?.[requestedKey] || requestedKey), distinctUntilChanged())
|
|
361
|
+
: of(requestedKey);
|
|
367
362
|
}
|
|
368
363
|
/**
|
|
369
364
|
* Returns a stream of translated values of a key which updates whenever the language changes.
|
|
@@ -374,10 +369,10 @@ class LocalizationService {
|
|
|
374
369
|
translate(key, interpolateParams) {
|
|
375
370
|
return this.getKey(key).pipe(switchMap((translationKey) => this.getTranslationStream(translationKey, interpolateParams)), shareReplay({ refCount: true, bufferSize: 1 }));
|
|
376
371
|
}
|
|
377
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
378
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
372
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationService, deps: [{ token: i2.TranslateService }, { token: i1.LoggerService }, { token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i3.Store, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
373
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationService }); }
|
|
379
374
|
}
|
|
380
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
375
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationService, decorators: [{
|
|
381
376
|
type: Injectable
|
|
382
377
|
}], ctorParameters: () => [{ type: i2.TranslateService }, { type: i1.LoggerService }, { type: undefined, decorators: [{
|
|
383
378
|
type: Inject,
|
|
@@ -424,7 +419,7 @@ class LocalizationTranslateDirective extends TranslateDirective {
|
|
|
424
419
|
*/
|
|
425
420
|
setContent(node, content) {
|
|
426
421
|
const key = node.originalContent;
|
|
427
|
-
const newContent = this.showKeys ? key : this.localizationConfig.debugMode && key ? `${key} - ${content}` : content;
|
|
422
|
+
const newContent = this.showKeys ? key : (this.localizationConfig.debugMode && key ? `${key} - ${content}` : content);
|
|
428
423
|
if (typeof node.textContent !== 'undefined' && node.textContent !== null) {
|
|
429
424
|
node.textContent = newContent;
|
|
430
425
|
}
|
|
@@ -441,10 +436,10 @@ class LocalizationTranslateDirective extends TranslateDirective {
|
|
|
441
436
|
this.onKeyChange?.unsubscribe();
|
|
442
437
|
}
|
|
443
438
|
}
|
|
444
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
445
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.
|
|
439
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationTranslateDirective, deps: [{ token: LocalizationService }, { token: i2.TranslateService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: LOCALIZATION_CONFIGURATION_TOKEN }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
440
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.13", type: LocalizationTranslateDirective, selector: "[translate],[ngx-translate]", inputs: { translate: "translate" }, usesInheritance: true, ngImport: i0 }); }
|
|
446
441
|
}
|
|
447
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
442
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationTranslateDirective, decorators: [{
|
|
448
443
|
type: Directive,
|
|
449
444
|
args: [{
|
|
450
445
|
selector: '[translate],[ngx-translate]'
|
|
@@ -512,10 +507,10 @@ class O3rLocalizationTranslatePipe extends TranslatePipe {
|
|
|
512
507
|
this.onKeyChange.unsubscribe();
|
|
513
508
|
}
|
|
514
509
|
}
|
|
515
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
516
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.
|
|
510
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: O3rLocalizationTranslatePipe, deps: [{ token: LocalizationService }, { token: i2.TranslateService }, { token: i0.ChangeDetectorRef }, { token: LOCALIZATION_CONFIGURATION_TOKEN }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
511
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: O3rLocalizationTranslatePipe, name: "o3rTranslate", pure: false }); }
|
|
517
512
|
}
|
|
518
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
513
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: O3rLocalizationTranslatePipe, decorators: [{
|
|
519
514
|
type: Pipe,
|
|
520
515
|
args: [{ name: 'o3rTranslate', pure: false }]
|
|
521
516
|
}], ctorParameters: () => [{ type: LocalizationService }, { type: i2.TranslateService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
@@ -527,10 +522,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
|
|
|
527
522
|
* @deprecated please use O3rLocalizationTranslatePipe, will be removed in v12.
|
|
528
523
|
*/
|
|
529
524
|
class LocalizationTranslatePipe extends O3rLocalizationTranslatePipe {
|
|
530
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
531
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.
|
|
525
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationTranslatePipe, deps: null, target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
526
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LocalizationTranslatePipe, name: "translate", pure: false }); }
|
|
532
527
|
}
|
|
533
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
528
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationTranslatePipe, decorators: [{
|
|
534
529
|
type: Pipe,
|
|
535
530
|
args: [{ name: 'translate', pure: false }]
|
|
536
531
|
}] });
|
|
@@ -551,10 +546,10 @@ class LocalizedCurrencyPipe extends CurrencyPipe {
|
|
|
551
546
|
ngOnDestroy() {
|
|
552
547
|
this.onLangChange.unsubscribe();
|
|
553
548
|
}
|
|
554
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
555
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.
|
|
549
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizedCurrencyPipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
550
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LocalizedCurrencyPipe, name: "currency", pure: false }); }
|
|
556
551
|
}
|
|
557
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
552
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizedCurrencyPipe, decorators: [{
|
|
558
553
|
type: Pipe,
|
|
559
554
|
args: [{
|
|
560
555
|
name: 'currency',
|
|
@@ -573,20 +568,15 @@ class LocalizedDatePipe extends DatePipe {
|
|
|
573
568
|
this.onLangChange = this.localizationService.getTranslateService().onLangChange.subscribe(() => this.changeDetectorRef.markForCheck());
|
|
574
569
|
}
|
|
575
570
|
transform(value, format = 'mediumDate', timezone, locale) {
|
|
576
|
-
|
|
577
|
-
return format;
|
|
578
|
-
}
|
|
579
|
-
else {
|
|
580
|
-
return super.transform(value, format, timezone, locale || this.localizationService.getCurrentLanguage());
|
|
581
|
-
}
|
|
571
|
+
return this.localizationService.showKeys ? format : super.transform(value, format, timezone, locale || this.localizationService.getCurrentLanguage());
|
|
582
572
|
}
|
|
583
573
|
ngOnDestroy() {
|
|
584
574
|
this.onLangChange.unsubscribe();
|
|
585
575
|
}
|
|
586
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
587
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.
|
|
576
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizedDatePipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
577
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LocalizedDatePipe, name: "date", pure: false }); }
|
|
588
578
|
}
|
|
589
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
579
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizedDatePipe, decorators: [{
|
|
590
580
|
type: Pipe,
|
|
591
581
|
args: [{
|
|
592
582
|
name: 'date',
|
|
@@ -610,10 +600,10 @@ class LocalizedDecimalPipe extends DecimalPipe {
|
|
|
610
600
|
ngOnDestroy() {
|
|
611
601
|
this.onLangChange.unsubscribe();
|
|
612
602
|
}
|
|
613
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
614
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.
|
|
603
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizedDecimalPipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
604
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LocalizedDecimalPipe, name: "decimal", pure: false }); }
|
|
615
605
|
}
|
|
616
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
606
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizedDecimalPipe, decorators: [{
|
|
617
607
|
type: Pipe,
|
|
618
608
|
args: [{
|
|
619
609
|
name: 'decimal',
|
|
@@ -641,16 +631,16 @@ class TextDirectionService {
|
|
|
641
631
|
return this.subscription;
|
|
642
632
|
}
|
|
643
633
|
this.subscription = this.translateService.onLangChange.subscribe((event) => {
|
|
644
|
-
const direction = this.configuration.rtlLanguages.
|
|
634
|
+
const direction = this.configuration.rtlLanguages.includes(event.lang.split('-')[0]) ? 'rtl' : 'ltr';
|
|
645
635
|
this.renderer.setAttribute(document.body, 'dir', direction);
|
|
646
636
|
this.directionality.change.emit(direction);
|
|
647
637
|
});
|
|
648
638
|
return this.subscription;
|
|
649
639
|
}
|
|
650
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
651
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
640
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextDirectionService, deps: [{ token: i2.TranslateService }, { token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i0.RendererFactory2 }, { token: i2$1.Directionality }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
641
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextDirectionService }); }
|
|
652
642
|
}
|
|
653
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
643
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextDirectionService, decorators: [{
|
|
654
644
|
type: Injectable
|
|
655
645
|
}], ctorParameters: () => [{ type: i2.TranslateService }, { type: undefined, decorators: [{
|
|
656
646
|
type: Inject,
|
|
@@ -667,10 +657,10 @@ class TextDirectionality extends Directionality {
|
|
|
667
657
|
ngOnDestroy() {
|
|
668
658
|
this.change.complete();
|
|
669
659
|
}
|
|
670
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
671
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
660
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextDirectionality, deps: [{ token: DIR_DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
661
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextDirectionality }); }
|
|
672
662
|
}
|
|
673
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
663
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TextDirectionality, decorators: [{
|
|
674
664
|
type: Injectable
|
|
675
665
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
676
666
|
type: Optional
|
|
@@ -686,7 +676,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.12", ngImpo
|
|
|
686
676
|
function createLocalizationConfiguration(configuration) {
|
|
687
677
|
return {
|
|
688
678
|
...DEFAULT_LOCALIZATION_CONFIGURATION,
|
|
689
|
-
...
|
|
679
|
+
...configuration
|
|
690
680
|
};
|
|
691
681
|
}
|
|
692
682
|
/**
|
|
@@ -713,16 +703,18 @@ class LocalizationModule {
|
|
|
713
703
|
ngModule: LocalizationModule,
|
|
714
704
|
providers: [
|
|
715
705
|
LocalizationService,
|
|
716
|
-
...(configuration
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
706
|
+
...(configuration
|
|
707
|
+
? [{
|
|
708
|
+
provide: CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN,
|
|
709
|
+
useFactory: configuration
|
|
710
|
+
}]
|
|
711
|
+
: [])
|
|
720
712
|
]
|
|
721
713
|
};
|
|
722
714
|
}
|
|
723
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
724
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.
|
|
725
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.
|
|
715
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
716
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LocalizationModule, declarations: [O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule], exports: [TranslateModule, O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe] }); }
|
|
717
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationModule, providers: [
|
|
726
718
|
{ provide: LOCALIZATION_CONFIGURATION_TOKEN, useFactory: createLocalizationConfiguration, deps: [[new Optional(), CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN]] },
|
|
727
719
|
{ provide: LOCALE_ID, useFactory: localeIdNgBridge, deps: [LocalizationService] },
|
|
728
720
|
{ provide: Directionality, useClass: TextDirectionality },
|
|
@@ -732,7 +724,7 @@ class LocalizationModule {
|
|
|
732
724
|
TextDirectionService
|
|
733
725
|
], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule, TranslateModule] }); }
|
|
734
726
|
}
|
|
735
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
727
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
736
728
|
type: NgModule,
|
|
737
729
|
args: [{
|
|
738
730
|
declarations: [O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe],
|
|
@@ -783,7 +775,7 @@ class TranslationsLoader {
|
|
|
783
775
|
let localizationPath$ = of(this.localizationConfiguration.endPointUrl);
|
|
784
776
|
if (this.localizationConfiguration.useDynamicContent) {
|
|
785
777
|
if (!this.dynamicContentService) {
|
|
786
|
-
throw Error('Dynamic Content is not available. Please verify you have imported the module DynamicContentModule in your application');
|
|
778
|
+
throw new Error('Dynamic Content is not available. Please verify you have imported the module DynamicContentModule in your application');
|
|
787
779
|
}
|
|
788
780
|
localizationPath$ = this.dynamicContentService.getContentPathStream(this.localizationConfiguration.endPointUrl);
|
|
789
781
|
}
|
|
@@ -829,20 +821,20 @@ class TranslationsLoader {
|
|
|
829
821
|
getTranslationFromLocal(lang, fallbackLanguage) {
|
|
830
822
|
const pathPrefix = this.localizationConfiguration.bundlesOutputPath;
|
|
831
823
|
return this.downloadLanguageBundle$(pathPrefix + lang + JSON_EXT).pipe(catchError(() => {
|
|
832
|
-
if (lang
|
|
833
|
-
this.logger?.warn(`Failed to load ${lang} from ${pathPrefix + lang + JSON_EXT}. Application will fallback to ${fallbackLanguage}`);
|
|
834
|
-
return this.downloadLanguageBundle$(pathPrefix + fallbackLanguage + JSON_EXT).pipe(catchError(() => of({})));
|
|
835
|
-
}
|
|
836
|
-
else {
|
|
824
|
+
if (lang === fallbackLanguage) {
|
|
837
825
|
this.logger?.warn(`Failed to load ${lang} from ${pathPrefix + lang + JSON_EXT}.`);
|
|
838
826
|
return of({});
|
|
839
827
|
}
|
|
828
|
+
else {
|
|
829
|
+
this.logger?.warn(`Failed to load ${lang} from ${pathPrefix + lang + JSON_EXT}. Application will fallback to ${fallbackLanguage}`);
|
|
830
|
+
return this.downloadLanguageBundle$(pathPrefix + fallbackLanguage + JSON_EXT).pipe(catchError(() => of({})));
|
|
831
|
+
}
|
|
840
832
|
}));
|
|
841
833
|
}
|
|
842
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
843
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
834
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TranslationsLoader, deps: [{ token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i1.LoggerService, optional: true }, { token: i2$2.DynamicContentService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
835
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TranslationsLoader }); }
|
|
844
836
|
}
|
|
845
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
837
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: TranslationsLoader, decorators: [{
|
|
846
838
|
type: Injectable
|
|
847
839
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
848
840
|
type: Inject,
|
|
@@ -953,10 +945,10 @@ class OtterLocalizationDevtools {
|
|
|
953
945
|
this.localizationService.getTranslateService().setTranslation(language || this.getCurrentLanguage(), initialLocs);
|
|
954
946
|
this.appRef.tick();
|
|
955
947
|
}
|
|
956
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
957
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
948
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OtterLocalizationDevtools, deps: [{ token: LocalizationService }, { token: i2.TranslateCompiler }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
949
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OtterLocalizationDevtools }); }
|
|
958
950
|
}
|
|
959
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
951
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: OtterLocalizationDevtools, decorators: [{
|
|
960
952
|
type: Injectable
|
|
961
953
|
}], ctorParameters: () => [{ type: LocalizationService }, { type: i2.TranslateCompiler }, { type: i0.ApplicationRef }] });
|
|
962
954
|
|
|
@@ -967,7 +959,7 @@ const OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS = {
|
|
|
967
959
|
};
|
|
968
960
|
const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS = new InjectionToken('Otter Localization Devtools options');
|
|
969
961
|
|
|
970
|
-
/* eslint-disable no-console */
|
|
962
|
+
/* eslint-disable no-console -- This is the purpose of this service */
|
|
971
963
|
class LocalizationDevtoolsConsoleService {
|
|
972
964
|
/** Name of the Window property to access to the devtools */
|
|
973
965
|
static { this.windowModuleName = 'localization'; }
|
|
@@ -983,9 +975,7 @@ class LocalizationDevtoolsConsoleService {
|
|
|
983
975
|
/** @inheritDoc */
|
|
984
976
|
activate() {
|
|
985
977
|
const windowWithDevtools = window;
|
|
986
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
987
978
|
windowWithDevtools._OTTER_DEVTOOLS_ ||= {};
|
|
988
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
989
979
|
windowWithDevtools._OTTER_DEVTOOLS_[LocalizationDevtoolsConsoleService.windowModuleName] = this;
|
|
990
980
|
console.info(`Otter localization Devtools is now accessible via the _OTTER_DEVTOOLS_.${LocalizationDevtoolsConsoleService.windowModuleName} variable`);
|
|
991
981
|
}
|
|
@@ -1039,10 +1029,10 @@ class LocalizationDevtoolsConsoleService {
|
|
|
1039
1029
|
reloadLocalizationKeys(language) {
|
|
1040
1030
|
return this.localizationDevtools.reloadLocalizationKeys(language);
|
|
1041
1031
|
}
|
|
1042
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
1043
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
1032
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsConsoleService, deps: [{ token: OtterLocalizationDevtools }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1033
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsConsoleService }); }
|
|
1044
1034
|
}
|
|
1045
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
1035
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsConsoleService, decorators: [{
|
|
1046
1036
|
type: Injectable
|
|
1047
1037
|
}], ctorParameters: () => [{ type: OtterLocalizationDevtools }, { type: undefined, decorators: [{
|
|
1048
1038
|
type: Optional
|
|
@@ -1069,8 +1059,8 @@ class LocalizationDevtoolsMessageService {
|
|
|
1069
1059
|
this.localizationDevTools = localizationDevTools;
|
|
1070
1060
|
this.localizationService = localizationService;
|
|
1071
1061
|
this.options = options;
|
|
1072
|
-
this.subscriptions = new Subscription();
|
|
1073
1062
|
this.sendMessage = (sendOtterMessage);
|
|
1063
|
+
this.destroyRef = inject(DestroyRef);
|
|
1074
1064
|
this.options = {
|
|
1075
1065
|
...OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS,
|
|
1076
1066
|
...this.options
|
|
@@ -1110,8 +1100,7 @@ class LocalizationDevtoolsMessageService {
|
|
|
1110
1100
|
}
|
|
1111
1101
|
/**
|
|
1112
1102
|
* Function to handle the incoming messages from Otter Chrome DevTools extension
|
|
1113
|
-
* @param
|
|
1114
|
-
* @param message
|
|
1103
|
+
* @param message Message coming from the Otter Chrome DevTools extension
|
|
1115
1104
|
*/
|
|
1116
1105
|
handleEvents(message) {
|
|
1117
1106
|
this.logger.debug('Message handling by the localization service', message);
|
|
@@ -1155,16 +1144,12 @@ class LocalizationDevtoolsMessageService {
|
|
|
1155
1144
|
}
|
|
1156
1145
|
/** @inheritDoc */
|
|
1157
1146
|
activate() {
|
|
1158
|
-
|
|
1159
|
-
}
|
|
1160
|
-
/** @inheritDoc */
|
|
1161
|
-
ngOnDestroy() {
|
|
1162
|
-
this.subscriptions.unsubscribe();
|
|
1147
|
+
fromEvent(window, 'message').pipe(takeUntilDestroyed(this.destroyRef), filterMessageContent(isLocalizationMessage)).subscribe((e) => this.handleEvents(e));
|
|
1163
1148
|
}
|
|
1164
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
1165
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.
|
|
1149
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsMessageService, deps: [{ token: i1.LoggerService }, { token: OtterLocalizationDevtools }, { token: LocalizationService }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1150
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsMessageService }); }
|
|
1166
1151
|
}
|
|
1167
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
1152
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsMessageService, decorators: [{
|
|
1168
1153
|
type: Injectable
|
|
1169
1154
|
}], ctorParameters: () => [{ type: i1.LoggerService }, { type: OtterLocalizationDevtools }, { type: LocalizationService }, { type: undefined, decorators: [{
|
|
1170
1155
|
type: Optional
|
|
@@ -1189,16 +1174,16 @@ class LocalizationDevtoolsModule {
|
|
|
1189
1174
|
]
|
|
1190
1175
|
};
|
|
1191
1176
|
}
|
|
1192
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.
|
|
1193
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.
|
|
1194
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.
|
|
1177
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1178
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsModule, imports: [LocalizationModule] }); }
|
|
1179
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsModule, providers: [
|
|
1195
1180
|
{ provide: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, useValue: OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS },
|
|
1196
1181
|
LocalizationDevtoolsMessageService,
|
|
1197
1182
|
LocalizationDevtoolsConsoleService,
|
|
1198
1183
|
OtterLocalizationDevtools
|
|
1199
1184
|
], imports: [LocalizationModule] }); }
|
|
1200
1185
|
}
|
|
1201
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.
|
|
1186
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LocalizationDevtoolsModule, decorators: [{
|
|
1202
1187
|
type: NgModule,
|
|
1203
1188
|
args: [{
|
|
1204
1189
|
imports: [
|