@o3r/localization 11.0.0-next.0 → 11.0.0-next.2
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 +18 -13
- package/builders/helpers/localization.generator.d.ts +2 -2
- package/builders/helpers/localization.generator.d.ts.map +1 -1
- package/builders/helpers/localization.generator.js +8 -4
- package/builders/helpers/localization.generator.js.map +1 -1
- package/builders/i18n/index.d.ts.map +1 -1
- package/builders/i18n/index.js +3 -2
- package/builders/i18n/index.js.map +1 -1
- package/builders/localization/index.d.ts.map +1 -1
- package/builders/localization/index.js +13 -5
- package/builders/localization/index.js.map +1 -1
- package/builders/localization/schema.json +1 -2
- package/builders/localization-extractor/index.d.ts.map +1 -1
- package/builders/localization-extractor/index.js +2 -2
- package/builders/localization-extractor/index.js.map +1 -1
- package/builders/localization-extractor/validations.js.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 +6 -6
- package/devkit/localization-devtools.console.service.d.ts.map +1 -1
- package/devkit/localization-devtools.message.service.d.ts +11 -2
- package/devkit/localization-devtools.message.service.d.ts.map +1 -1
- package/devkit/localization-devtools.service.d.ts +30 -1
- package/devkit/localization-devtools.service.d.ts.map +1 -1
- package/devkit/localization-devtools.token.d.ts.map +1 -1
- package/esm2022/annotations/localization.mjs +1 -1
- package/esm2022/core/translate-messageformat-lazy.compiler.mjs +4 -4
- package/esm2022/devkit/localization-devkit.interface.mjs +1 -1
- package/esm2022/devkit/localization-devtools.console.service.mjs +17 -27
- package/esm2022/devkit/localization-devtools.message.service.mjs +73 -9
- package/esm2022/devkit/localization-devtools.module.mjs +4 -4
- package/esm2022/devkit/localization-devtools.service.mjs +58 -7
- package/esm2022/devkit/localization-devtools.token.mjs +3 -2
- package/esm2022/rules-engine/localization.handler-action.mjs +3 -3
- package/esm2022/rules-engine/localization.rules-engine.module.mjs +4 -4
- package/esm2022/stores/localization-override/localization-override.module.mjs +4 -4
- package/esm2022/stores/localization-override/localization-override.state.mjs +1 -1
- package/esm2022/stores/localization-override/localization-override.sync.mjs +1 -1
- package/esm2022/tools/localization-translate.directive.mjs +4 -4
- package/esm2022/tools/localization-translate.pipe.mjs +18 -6
- package/esm2022/tools/localization.module.mjs +8 -8
- package/esm2022/tools/localization.service.mjs +10 -4
- package/esm2022/tools/localized-currency.pipe.mjs +3 -3
- package/esm2022/tools/localized-date.pipe.mjs +4 -4
- package/esm2022/tools/localized-decimal.pipe.mjs +3 -3
- package/esm2022/tools/text-direction.service.mjs +4 -4
- package/esm2022/tools/text-directionality.service.mjs +3 -3
- package/esm2022/tools/translations-loader.mjs +4 -4
- package/fesm2022/o3r-localization-rules-engine.mjs +7 -7
- package/fesm2022/o3r-localization.mjs +207 -84
- package/fesm2022/o3r-localization.mjs.map +1 -1
- package/migration.json +10 -0
- package/package.json +32 -21
- package/schemas/localization.schema.json +116 -0
- package/schematics/add-localization-key/index.d.ts +6 -2
- package/schematics/add-localization-key/index.d.ts.map +1 -1
- package/schematics/add-localization-key/index.js +12 -8
- package/schematics/add-localization-key/index.js.map +1 -1
- package/schematics/cms-adapter/index.d.ts +2 -3
- package/schematics/cms-adapter/index.d.ts.map +1 -1
- package/schematics/cms-adapter/index.js +7 -3
- package/schematics/cms-adapter/index.js.map +1 -1
- package/schematics/localization-base/index.d.ts +2 -7
- package/schematics/localization-base/index.d.ts.map +1 -1
- package/schematics/localization-base/index.js +20 -40
- package/schematics/localization-base/index.js.map +1 -1
- package/schematics/localization-to-component/index.d.ts +6 -2
- package/schematics/localization-to-component/index.d.ts.map +1 -1
- package/schematics/localization-to-component/index.js +10 -6
- package/schematics/localization-to-component/index.js.map +1 -1
- package/schematics/localization-to-component/templates/__name__.localization.json +3 -1
- package/schematics/ng-add/index.d.ts +1 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +67 -53
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.d.ts +2 -0
- package/schematics/ng-add/schema.d.ts.map +1 -1
- package/schematics/ng-add/schema.json +5 -0
- package/schematics/ng-update/v10-0/index.d.ts +6 -0
- package/schematics/ng-update/v10-0/index.d.ts.map +1 -0
- package/schematics/ng-update/v10-0/index.js +30 -0
- package/schematics/ng-update/v10-0/index.js.map +1 -0
- package/stores/localization-override/localization-override.state.d.ts.map +1 -1
- package/tools/localization-translate.pipe.d.ts +18 -9
- package/tools/localization-translate.pipe.d.ts.map +1 -1
- package/tools/localization.module.d.ts +1 -1
- package/tools/localization.service.d.ts +4 -0
- package/tools/localization.service.d.ts.map +1 -1
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { immutablePrimitive, deepFill, otterComponentInfoPropertyName, filterMessageContent } from '@o3r/core';
|
|
1
|
+
import { immutablePrimitive, deepFill, otterComponentInfoPropertyName, sendOtterMessage, filterMessageContent } from '@o3r/core';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
3
|
import { InjectionToken, Injectable, Optional, Inject, NgModule, Directive, Input, Pipe, LOCALE_ID } 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, Subscription, fromEvent } from 'rxjs';
|
|
8
|
-
import { map, distinctUntilChanged, switchMap, shareReplay, startWith, catchError, take } from 'rxjs/operators';
|
|
7
|
+
import { BehaviorSubject, combineLatest, of, from, lastValueFrom, Subscription, firstValueFrom, fromEvent } from 'rxjs';
|
|
9
8
|
import * as i3 from '@ngrx/store';
|
|
10
|
-
import {
|
|
9
|
+
import { createAction, props, on, createReducer, StoreModule, createFeatureSelector, createSelector, select } from '@ngrx/store';
|
|
11
10
|
import * as i1 from '@o3r/logger';
|
|
12
11
|
import { LoggerService } from '@o3r/logger';
|
|
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';
|
|
@@ -111,10 +111,10 @@ class TranslateMessageFormatLazyCompiler extends TranslateCompiler {
|
|
|
111
111
|
return Object.keys(translations)
|
|
112
112
|
.reduce(compilingStrategy, {});
|
|
113
113
|
}
|
|
114
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
115
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
114
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", 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.3.6", ngImport: i0, type: TranslateMessageFormatLazyCompiler }); }
|
|
116
116
|
}
|
|
117
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", 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: "17.
|
|
169
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.
|
|
170
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.
|
|
168
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationOverrideStoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
169
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: LocalizationOverrideStoreModule, imports: [i3.StoreFeatureModule] }); }
|
|
170
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.6", 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: "17.
|
|
174
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationOverrideStoreModule, decorators: [{
|
|
175
175
|
type: NgModule,
|
|
176
176
|
args: [{
|
|
177
177
|
imports: [
|
|
@@ -304,6 +304,12 @@ class LocalizationService {
|
|
|
304
304
|
this.translateService.setDefaultLang(language);
|
|
305
305
|
this.useLanguage(language);
|
|
306
306
|
}
|
|
307
|
+
/**
|
|
308
|
+
* Is the translation deactivation enabled
|
|
309
|
+
*/
|
|
310
|
+
isTranslationDeactivationEnabled() {
|
|
311
|
+
return this.configuration.enableTranslationDeactivation;
|
|
312
|
+
}
|
|
307
313
|
/**
|
|
308
314
|
* Wrapper to call the ngx-translate service TranslateService method getLangs().
|
|
309
315
|
*/
|
|
@@ -368,10 +374,10 @@ class LocalizationService {
|
|
|
368
374
|
translate(key, interpolateParams) {
|
|
369
375
|
return this.getKey(key).pipe(switchMap((translationKey) => this.getTranslationStream(translationKey, interpolateParams)), shareReplay(1));
|
|
370
376
|
}
|
|
371
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
372
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
377
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationService, deps: [{ token: i2.TranslateService }, { token: i1.LoggerService }, { token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i3.Store, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
378
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationService }); }
|
|
373
379
|
}
|
|
374
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
380
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationService, decorators: [{
|
|
375
381
|
type: Injectable
|
|
376
382
|
}], ctorParameters: () => [{ type: i2.TranslateService }, { type: i1.LoggerService }, { type: undefined, decorators: [{
|
|
377
383
|
type: Inject,
|
|
@@ -435,10 +441,10 @@ class LocalizationTranslateDirective extends TranslateDirective {
|
|
|
435
441
|
this.onKeyChange?.unsubscribe();
|
|
436
442
|
}
|
|
437
443
|
}
|
|
438
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
439
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.
|
|
444
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationTranslateDirective, deps: [{ token: LocalizationService }, { token: i2.TranslateService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: LOCALIZATION_CONFIGURATION_TOKEN }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
445
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.3.6", type: LocalizationTranslateDirective, selector: "[translate],[ngx-translate]", inputs: { translate: "translate" }, usesInheritance: true, ngImport: i0 }); }
|
|
440
446
|
}
|
|
441
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
447
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationTranslateDirective, decorators: [{
|
|
442
448
|
type: Directive,
|
|
443
449
|
args: [{
|
|
444
450
|
selector: '[translate],[ngx-translate]'
|
|
@@ -453,7 +459,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
453
459
|
/**
|
|
454
460
|
* TranslatePipe class adding debug functionality
|
|
455
461
|
*/
|
|
456
|
-
class
|
|
462
|
+
class O3rLocalizationTranslatePipe extends TranslatePipe {
|
|
457
463
|
constructor(localizationService, translateService, changeDetector, localizationConfig) {
|
|
458
464
|
super(translateService, changeDetector);
|
|
459
465
|
this.localizationService = localizationService;
|
|
@@ -503,16 +509,28 @@ class LocalizationTranslatePipe extends TranslatePipe {
|
|
|
503
509
|
this.onShowKeysChange.unsubscribe();
|
|
504
510
|
}
|
|
505
511
|
}
|
|
506
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
507
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.
|
|
512
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: O3rLocalizationTranslatePipe, deps: [{ token: LocalizationService }, { token: i2.TranslateService }, { token: i0.ChangeDetectorRef }, { token: LOCALIZATION_CONFIGURATION_TOKEN }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
513
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: O3rLocalizationTranslatePipe, name: "o3rTranslate", pure: false }); }
|
|
508
514
|
}
|
|
509
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: O3rLocalizationTranslatePipe, decorators: [{
|
|
510
516
|
type: Pipe,
|
|
511
|
-
args: [{ name: '
|
|
517
|
+
args: [{ name: 'o3rTranslate', pure: false }]
|
|
512
518
|
}], ctorParameters: () => [{ type: LocalizationService }, { type: i2.TranslateService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
513
519
|
type: Inject,
|
|
514
520
|
args: [LOCALIZATION_CONFIGURATION_TOKEN]
|
|
515
521
|
}] }] });
|
|
522
|
+
/**
|
|
523
|
+
* TranslatePipe class adding debug functionality
|
|
524
|
+
* @deprecated please use O3rLocalizationTranslatePipe, will be removed in v12.
|
|
525
|
+
*/
|
|
526
|
+
class LocalizationTranslatePipe extends O3rLocalizationTranslatePipe {
|
|
527
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationTranslatePipe, deps: null, target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
528
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: LocalizationTranslatePipe, name: "translate", pure: false }); }
|
|
529
|
+
}
|
|
530
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationTranslatePipe, decorators: [{
|
|
531
|
+
type: Pipe,
|
|
532
|
+
args: [{ name: 'translate', pure: false }]
|
|
533
|
+
}] });
|
|
516
534
|
|
|
517
535
|
/**
|
|
518
536
|
* Native angular CurrencyPipe taking the current lang into consideration
|
|
@@ -530,10 +548,10 @@ class LocalizedCurrencyPipe extends CurrencyPipe {
|
|
|
530
548
|
ngOnDestroy() {
|
|
531
549
|
this.onLangChange.unsubscribe();
|
|
532
550
|
}
|
|
533
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
534
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.
|
|
551
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizedCurrencyPipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
552
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: LocalizedCurrencyPipe, name: "currency", pure: false }); }
|
|
535
553
|
}
|
|
536
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
554
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizedCurrencyPipe, decorators: [{
|
|
537
555
|
type: Pipe,
|
|
538
556
|
args: [{
|
|
539
557
|
name: 'currency',
|
|
@@ -562,10 +580,10 @@ class LocalizedDatePipe extends DatePipe {
|
|
|
562
580
|
ngOnDestroy() {
|
|
563
581
|
this.onLangChange.unsubscribe();
|
|
564
582
|
}
|
|
565
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
566
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.
|
|
583
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizedDatePipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
584
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: LocalizedDatePipe, name: "date", pure: false }); }
|
|
567
585
|
}
|
|
568
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
586
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizedDatePipe, decorators: [{
|
|
569
587
|
type: Pipe,
|
|
570
588
|
args: [{
|
|
571
589
|
name: 'date',
|
|
@@ -589,10 +607,10 @@ class LocalizedDecimalPipe extends DecimalPipe {
|
|
|
589
607
|
ngOnDestroy() {
|
|
590
608
|
this.onLangChange.unsubscribe();
|
|
591
609
|
}
|
|
592
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
593
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.
|
|
610
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizedDecimalPipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
611
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: LocalizedDecimalPipe, name: "decimal", pure: false }); }
|
|
594
612
|
}
|
|
595
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
613
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizedDecimalPipe, decorators: [{
|
|
596
614
|
type: Pipe,
|
|
597
615
|
args: [{
|
|
598
616
|
name: 'decimal',
|
|
@@ -626,10 +644,10 @@ class TextDirectionService {
|
|
|
626
644
|
});
|
|
627
645
|
return this.subscription;
|
|
628
646
|
}
|
|
629
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
630
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
647
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TextDirectionService, deps: [{ token: i2.TranslateService }, { token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i0.RendererFactory2 }, { token: i2$1.Directionality }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
648
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TextDirectionService }); }
|
|
631
649
|
}
|
|
632
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
650
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TextDirectionService, decorators: [{
|
|
633
651
|
type: Injectable
|
|
634
652
|
}], ctorParameters: () => [{ type: i2.TranslateService }, { type: undefined, decorators: [{
|
|
635
653
|
type: Inject,
|
|
@@ -646,10 +664,10 @@ class TextDirectionality extends Directionality {
|
|
|
646
664
|
ngOnDestroy() {
|
|
647
665
|
this.change.complete();
|
|
648
666
|
}
|
|
649
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
650
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
667
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TextDirectionality, deps: [{ token: DIR_DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
668
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TextDirectionality }); }
|
|
651
669
|
}
|
|
652
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
670
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TextDirectionality, decorators: [{
|
|
653
671
|
type: Injectable
|
|
654
672
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
655
673
|
type: Optional
|
|
@@ -699,9 +717,9 @@ class LocalizationModule {
|
|
|
699
717
|
]
|
|
700
718
|
};
|
|
701
719
|
}
|
|
702
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
703
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.
|
|
704
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.
|
|
720
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
721
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: LocalizationModule, declarations: [O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule], exports: [TranslateModule, O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe] }); }
|
|
722
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationModule, providers: [
|
|
705
723
|
{ provide: LOCALIZATION_CONFIGURATION_TOKEN, useFactory: createLocalizationConfiguration, deps: [[new Optional(), CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN]] },
|
|
706
724
|
{ provide: LOCALE_ID, useFactory: localeIdNgBridge, deps: [LocalizationService] },
|
|
707
725
|
{ provide: Directionality, useClass: TextDirectionality },
|
|
@@ -711,12 +729,12 @@ class LocalizationModule {
|
|
|
711
729
|
TextDirectionService
|
|
712
730
|
], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule, TranslateModule] }); }
|
|
713
731
|
}
|
|
714
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
732
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
715
733
|
type: NgModule,
|
|
716
734
|
args: [{
|
|
717
|
-
declarations: [LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe],
|
|
735
|
+
declarations: [O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe],
|
|
718
736
|
imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule],
|
|
719
|
-
exports: [TranslateModule, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe],
|
|
737
|
+
exports: [TranslateModule, O3rLocalizationTranslatePipe, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe],
|
|
720
738
|
providers: [
|
|
721
739
|
{ provide: LOCALIZATION_CONFIGURATION_TOKEN, useFactory: createLocalizationConfiguration, deps: [[new Optional(), CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN]] },
|
|
722
740
|
{ provide: LOCALE_ID, useFactory: localeIdNgBridge, deps: [LocalizationService] },
|
|
@@ -818,10 +836,10 @@ class TranslationsLoader {
|
|
|
818
836
|
}
|
|
819
837
|
}));
|
|
820
838
|
}
|
|
821
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
822
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
839
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TranslationsLoader, deps: [{ token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i1.LoggerService, optional: true }, { token: i2$2.DynamicContentService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
840
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TranslationsLoader }); }
|
|
823
841
|
}
|
|
824
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
842
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: TranslationsLoader, decorators: [{
|
|
825
843
|
type: Injectable
|
|
826
844
|
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
827
845
|
type: Inject,
|
|
@@ -852,8 +870,16 @@ const translateLoaderProvider = {
|
|
|
852
870
|
};
|
|
853
871
|
|
|
854
872
|
class OtterLocalizationDevtools {
|
|
855
|
-
constructor(localizationService) {
|
|
873
|
+
constructor(localizationService, translateCompiler, appRef) {
|
|
856
874
|
this.localizationService = localizationService;
|
|
875
|
+
this.translateCompiler = translateCompiler;
|
|
876
|
+
this.appRef = appRef;
|
|
877
|
+
}
|
|
878
|
+
/**
|
|
879
|
+
* Is the translation deactivation enabled
|
|
880
|
+
*/
|
|
881
|
+
isTranslationDeactivationEnabled() {
|
|
882
|
+
return this.localizationService.isTranslationDeactivationEnabled();
|
|
857
883
|
}
|
|
858
884
|
/**
|
|
859
885
|
* Show localization keys
|
|
@@ -861,6 +887,7 @@ class OtterLocalizationDevtools {
|
|
|
861
887
|
*/
|
|
862
888
|
showLocalizationKeys(value) {
|
|
863
889
|
this.localizationService.toggleShowKeys(value);
|
|
890
|
+
this.appRef.tick();
|
|
864
891
|
}
|
|
865
892
|
/**
|
|
866
893
|
* Returns the current language
|
|
@@ -880,16 +907,56 @@ class OtterLocalizationDevtools {
|
|
|
880
907
|
fn(lang);
|
|
881
908
|
});
|
|
882
909
|
}
|
|
883
|
-
/**
|
|
884
|
-
|
|
910
|
+
/**
|
|
911
|
+
* Switch the current language to the specified value
|
|
912
|
+
* @param language new language to switch to
|
|
913
|
+
*/
|
|
914
|
+
async switchLanguage(language) {
|
|
915
|
+
await lastValueFrom(this.localizationService.useLanguage(language));
|
|
916
|
+
this.appRef.tick();
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Updates the specified localization key/values for the current language.
|
|
920
|
+
*
|
|
921
|
+
* Recommendation: To be used with a small number of keys to update to avoid performance issues.
|
|
922
|
+
* @param keyValues key/values to update
|
|
923
|
+
* @param language if not provided, the current language value
|
|
924
|
+
*/
|
|
925
|
+
updateLocalizationKeys(keyValues, language) {
|
|
926
|
+
const lang = language || this.getCurrentLanguage();
|
|
927
|
+
const translateService = this.localizationService.getTranslateService();
|
|
928
|
+
Object.entries(keyValues).forEach(([key, value]) => {
|
|
929
|
+
translateService.set(key, value, lang);
|
|
930
|
+
});
|
|
931
|
+
this.appRef.tick();
|
|
932
|
+
}
|
|
933
|
+
/**
|
|
934
|
+
* Reload a language from the language file
|
|
935
|
+
* @see https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.service.ts#L490
|
|
936
|
+
* @param language language to reload
|
|
937
|
+
*/
|
|
938
|
+
async reloadLocalizationKeys(language) {
|
|
939
|
+
const lang = language || this.getCurrentLanguage();
|
|
940
|
+
if (this.translateCompiler.clearCache) {
|
|
941
|
+
this.translateCompiler.clearCache();
|
|
942
|
+
}
|
|
943
|
+
const initialLocs = await lastValueFrom(this.localizationService
|
|
944
|
+
.getTranslateService()
|
|
945
|
+
.reloadLang(lang));
|
|
946
|
+
this.localizationService.getTranslateService().setTranslation(language || this.getCurrentLanguage(), initialLocs);
|
|
947
|
+
this.appRef.tick();
|
|
948
|
+
}
|
|
949
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: OtterLocalizationDevtools, deps: [{ token: LocalizationService }, { token: i2.TranslateCompiler }, { token: i0.ApplicationRef }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
950
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: OtterLocalizationDevtools }); }
|
|
885
951
|
}
|
|
886
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
952
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: OtterLocalizationDevtools, decorators: [{
|
|
887
953
|
type: Injectable
|
|
888
|
-
}], ctorParameters: () => [{ type: LocalizationService }] });
|
|
954
|
+
}], ctorParameters: () => [{ type: LocalizationService }, { type: i2.TranslateCompiler }, { type: i0.ApplicationRef }] });
|
|
889
955
|
|
|
890
956
|
const OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS = {
|
|
891
957
|
isActivatedOnBootstrap: false,
|
|
892
|
-
isActivatedOnBootstrapWhenCMSContext: true
|
|
958
|
+
isActivatedOnBootstrapWhenCMSContext: true,
|
|
959
|
+
metadataFilePath: './metadata/localisation.metadata.json'
|
|
893
960
|
};
|
|
894
961
|
const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS = new InjectionToken('Otter Localization Devtools options');
|
|
895
962
|
|
|
@@ -897,10 +964,8 @@ const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS = new InjectionToken('Otter Localizati
|
|
|
897
964
|
class LocalizationDevtoolsConsoleService {
|
|
898
965
|
/** Name of the Window property to access to the devtools */
|
|
899
966
|
static { this.windowModuleName = 'localization'; }
|
|
900
|
-
constructor(localizationDevtools,
|
|
967
|
+
constructor(localizationDevtools, options = OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS) {
|
|
901
968
|
this.localizationDevtools = localizationDevtools;
|
|
902
|
-
this.localizationService = localizationService;
|
|
903
|
-
this.appRef = appRef;
|
|
904
969
|
this.options = options;
|
|
905
970
|
if (this.options.isActivatedOnBootstrap
|
|
906
971
|
|| (this.options.isActivatedOnBootstrapWhenCMSContext
|
|
@@ -917,12 +982,17 @@ class LocalizationDevtoolsConsoleService {
|
|
|
917
982
|
windowWithDevtools._OTTER_DEVTOOLS_[LocalizationDevtoolsConsoleService.windowModuleName] = this;
|
|
918
983
|
console.info(`Otter localization Devtools is now accessible via the _OTTER_DEVTOOLS_.${LocalizationDevtoolsConsoleService.windowModuleName} variable`);
|
|
919
984
|
}
|
|
985
|
+
/**
|
|
986
|
+
* @inheritdoc
|
|
987
|
+
*/
|
|
988
|
+
isTranslationDeactivationEnabled() {
|
|
989
|
+
return this.localizationDevtools.isTranslationDeactivationEnabled();
|
|
990
|
+
}
|
|
920
991
|
/**
|
|
921
992
|
* @inheritdoc
|
|
922
993
|
*/
|
|
923
994
|
showLocalizationKeys(value) {
|
|
924
995
|
this.localizationDevtools.showLocalizationKeys(value);
|
|
925
|
-
this.appRef.tick();
|
|
926
996
|
}
|
|
927
997
|
/**
|
|
928
998
|
* @inheritdoc
|
|
@@ -936,8 +1006,7 @@ class LocalizationDevtoolsConsoleService {
|
|
|
936
1006
|
*/
|
|
937
1007
|
async switchLanguage(language) {
|
|
938
1008
|
const previous = this.localizationDevtools.getCurrentLanguage();
|
|
939
|
-
await
|
|
940
|
-
this.appRef.tick();
|
|
1009
|
+
await this.localizationDevtools.switchLanguage(language);
|
|
941
1010
|
const current = this.localizationDevtools.getCurrentLanguage();
|
|
942
1011
|
return {
|
|
943
1012
|
requested: language,
|
|
@@ -955,28 +1024,20 @@ class LocalizationDevtoolsConsoleService {
|
|
|
955
1024
|
* @inheritdoc
|
|
956
1025
|
*/
|
|
957
1026
|
updateLocalizationKeys(keyValues, language) {
|
|
958
|
-
|
|
959
|
-
this.localizationService.getTranslateService().set(key, value, language || this.localizationDevtools.getCurrentLanguage());
|
|
960
|
-
});
|
|
961
|
-
this.appRef.tick();
|
|
1027
|
+
return this.localizationDevtools.updateLocalizationKeys(keyValues, language);
|
|
962
1028
|
}
|
|
963
1029
|
/**
|
|
964
1030
|
* @inheritdoc
|
|
965
1031
|
*/
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
const initialLocs = await lastValueFrom(this.localizationService
|
|
969
|
-
.getTranslateService()
|
|
970
|
-
.reloadLang(lang)
|
|
971
|
-
.pipe(take(1)));
|
|
972
|
-
return this.updateLocalizationKeys(initialLocs, lang);
|
|
1032
|
+
reloadLocalizationKeys(language) {
|
|
1033
|
+
return this.localizationDevtools.reloadLocalizationKeys(language);
|
|
973
1034
|
}
|
|
974
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
975
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
1035
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsConsoleService, deps: [{ token: OtterLocalizationDevtools }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1036
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsConsoleService }); }
|
|
976
1037
|
}
|
|
977
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
1038
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsConsoleService, decorators: [{
|
|
978
1039
|
type: Injectable
|
|
979
|
-
}], ctorParameters: () => [{ type: OtterLocalizationDevtools }, { type:
|
|
1040
|
+
}], ctorParameters: () => [{ type: OtterLocalizationDevtools }, { type: undefined, decorators: [{
|
|
980
1041
|
type: Optional
|
|
981
1042
|
}, {
|
|
982
1043
|
type: Inject,
|
|
@@ -984,18 +1045,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
984
1045
|
}] }] });
|
|
985
1046
|
|
|
986
1047
|
const isLocalizationMessage = (message) => {
|
|
987
|
-
return message && message.dataType === 'displayLocalizationKeys'
|
|
1048
|
+
return message && (message.dataType === 'displayLocalizationKeys'
|
|
1049
|
+
|| message.dataType === 'languages'
|
|
1050
|
+
|| message.dataType === 'switchLanguage'
|
|
1051
|
+
|| message.dataType === 'localizations'
|
|
1052
|
+
|| message.dataType === 'updateLocalization'
|
|
1053
|
+
|| message.dataType === 'requestMessages'
|
|
1054
|
+
|| message.dataType === 'connect'
|
|
1055
|
+
|| message.dataType === 'reloadLocalizationKeys'
|
|
1056
|
+
|| message.dataType === 'isTranslationDeactivationEnabled'
|
|
1057
|
+
|| message.dataType === 'getTranslationValuesContentMessage');
|
|
988
1058
|
};
|
|
989
1059
|
class LocalizationDevtoolsMessageService {
|
|
990
|
-
constructor(logger, localizationDevTools, options = OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS) {
|
|
1060
|
+
constructor(logger, localizationDevTools, localizationService, options = OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS) {
|
|
991
1061
|
this.logger = logger;
|
|
992
1062
|
this.localizationDevTools = localizationDevTools;
|
|
1063
|
+
this.localizationService = localizationService;
|
|
993
1064
|
this.options = options;
|
|
994
1065
|
this.subscriptions = new Subscription();
|
|
1066
|
+
this.sendMessage = (sendOtterMessage);
|
|
1067
|
+
this.options = {
|
|
1068
|
+
...OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS,
|
|
1069
|
+
...this.options
|
|
1070
|
+
};
|
|
995
1071
|
if (this.options.isActivatedOnBootstrap) {
|
|
996
1072
|
this.activate();
|
|
997
1073
|
}
|
|
998
1074
|
}
|
|
1075
|
+
async sendLocalizationsMetadata() {
|
|
1076
|
+
const metadata = await (await fetch(this.options.metadataFilePath)).json();
|
|
1077
|
+
this.sendMessage('localizations', {
|
|
1078
|
+
localizations: metadata
|
|
1079
|
+
});
|
|
1080
|
+
}
|
|
1081
|
+
/**
|
|
1082
|
+
* Function to trigger a re-send a requested messages to the Otter Chrome DevTools extension
|
|
1083
|
+
* @param only restricted list of messages to re-send
|
|
1084
|
+
*/
|
|
1085
|
+
async handleReEmitRequest(only) {
|
|
1086
|
+
if (!only || only.includes('localizations')) {
|
|
1087
|
+
void this.sendLocalizationsMetadata();
|
|
1088
|
+
}
|
|
1089
|
+
if (!only || only.includes('switchLanguage')) {
|
|
1090
|
+
this.sendMessage('switchLanguage', { language: this.localizationDevTools.getCurrentLanguage() });
|
|
1091
|
+
}
|
|
1092
|
+
if (!only || only.includes('languages')) {
|
|
1093
|
+
this.sendMessage('languages', { languages: this.localizationService.getLanguages() });
|
|
1094
|
+
}
|
|
1095
|
+
if (!only || only.includes('getTranslationValuesContentMessage')) {
|
|
1096
|
+
this.sendMessage('getTranslationValuesContentMessage', {
|
|
1097
|
+
translations: await firstValueFrom(this.localizationService.getTranslateService().getTranslation(this.localizationService.getCurrentLanguage()))
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
if (!only || only.includes('isTranslationDeactivationEnabled')) {
|
|
1101
|
+
this.sendMessage('isTranslationDeactivationEnabled', { enabled: this.localizationService.isTranslationDeactivationEnabled() });
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
999
1104
|
/**
|
|
1000
1105
|
* Function to handle the incoming messages from Otter Chrome DevTools extension
|
|
1001
1106
|
* @param event Event coming from the Otter Chrome DevTools extension
|
|
@@ -1012,6 +1117,24 @@ class LocalizationDevtoolsMessageService {
|
|
|
1012
1117
|
this.localizationDevTools.showLocalizationKeys(message.toggle);
|
|
1013
1118
|
break;
|
|
1014
1119
|
}
|
|
1120
|
+
case 'requestMessages': {
|
|
1121
|
+
void this.handleReEmitRequest(message.only);
|
|
1122
|
+
break;
|
|
1123
|
+
}
|
|
1124
|
+
case 'switchLanguage': {
|
|
1125
|
+
void this.localizationDevTools.switchLanguage(message.language);
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1128
|
+
case 'updateLocalization': {
|
|
1129
|
+
void this.localizationDevTools.updateLocalizationKeys({
|
|
1130
|
+
[message.key]: message.value
|
|
1131
|
+
}, message.lang);
|
|
1132
|
+
break;
|
|
1133
|
+
}
|
|
1134
|
+
case 'reloadLocalizationKeys': {
|
|
1135
|
+
void this.localizationDevTools.reloadLocalizationKeys(message.lang);
|
|
1136
|
+
break;
|
|
1137
|
+
}
|
|
1015
1138
|
default: {
|
|
1016
1139
|
this.logger.warn('Message ignored by the localization service', message);
|
|
1017
1140
|
}
|
|
@@ -1031,12 +1154,12 @@ class LocalizationDevtoolsMessageService {
|
|
|
1031
1154
|
ngOnDestroy() {
|
|
1032
1155
|
this.subscriptions.unsubscribe();
|
|
1033
1156
|
}
|
|
1034
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
1035
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.
|
|
1157
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsMessageService, deps: [{ token: i1.LoggerService }, { token: OtterLocalizationDevtools }, { token: LocalizationService }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1158
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsMessageService }); }
|
|
1036
1159
|
}
|
|
1037
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
1160
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsMessageService, decorators: [{
|
|
1038
1161
|
type: Injectable
|
|
1039
|
-
}], ctorParameters: () => [{ type: i1.LoggerService }, { type: OtterLocalizationDevtools }, { type: undefined, decorators: [{
|
|
1162
|
+
}], ctorParameters: () => [{ type: i1.LoggerService }, { type: OtterLocalizationDevtools }, { type: LocalizationService }, { type: undefined, decorators: [{
|
|
1040
1163
|
type: Optional
|
|
1041
1164
|
}, {
|
|
1042
1165
|
type: Inject,
|
|
@@ -1059,16 +1182,16 @@ class LocalizationDevtoolsModule {
|
|
|
1059
1182
|
]
|
|
1060
1183
|
};
|
|
1061
1184
|
}
|
|
1062
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.
|
|
1063
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.
|
|
1064
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.
|
|
1185
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1186
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsModule, imports: [LocalizationModule] }); }
|
|
1187
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsModule, providers: [
|
|
1065
1188
|
{ provide: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, useValue: OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS },
|
|
1066
1189
|
LocalizationDevtoolsMessageService,
|
|
1067
1190
|
LocalizationDevtoolsConsoleService,
|
|
1068
1191
|
OtterLocalizationDevtools
|
|
1069
1192
|
], imports: [LocalizationModule] }); }
|
|
1070
1193
|
}
|
|
1071
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.
|
|
1194
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.6", ngImport: i0, type: LocalizationDevtoolsModule, decorators: [{
|
|
1072
1195
|
type: NgModule,
|
|
1073
1196
|
args: [{
|
|
1074
1197
|
imports: [
|
|
@@ -1087,5 +1210,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.8", ngImpor
|
|
|
1087
1210
|
* Generated bundle index. Do not edit.
|
|
1088
1211
|
*/
|
|
1089
1212
|
|
|
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 };
|
|
1213
|
+
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, O3rLocalizationTranslatePipe, 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 };
|
|
1091
1214
|
//# sourceMappingURL=o3r-localization.mjs.map
|