@o3r/localization 9.6.0-alpha.9 → 9.7.0-alpha.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 +11 -11
- package/builders/helpers/localization.generator.d.ts.map +1 -1
- package/builders/helpers/localization.generator.js +8 -3
- package/builders/helpers/localization.generator.js.map +1 -0
- package/builders/i18n/index.js.map +1 -0
- package/builders/i18n/schema.js.map +1 -0
- package/builders/localization/index.js +2 -2
- package/builders/localization/index.js.map +1 -0
- package/builders/localization/schema.js.map +1 -0
- package/builders/localization-extractor/index.d.ts.map +1 -1
- package/builders/localization-extractor/index.js +2 -0
- package/builders/localization-extractor/index.js.map +1 -0
- package/builders/localization-extractor/schema.d.ts +2 -0
- package/builders/localization-extractor/schema.d.ts.map +1 -1
- package/builders/localization-extractor/schema.js.map +1 -0
- package/builders/localization-extractor/schema.json +5 -0
- package/builders/localization-extractor/validations.js.map +1 -0
- 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 +37 -8
- package/devkit/localization-devtools.console.service.d.ts.map +1 -1
- package/devkit/localization-devtools.service.d.ts +10 -0
- package/devkit/localization-devtools.service.d.ts.map +1 -1
- package/devkit/localization-devtools.token.d.ts.map +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 +65 -11
- package/esm2022/devkit/localization-devtools.message.service.mjs +4 -4
- package/esm2022/devkit/localization-devtools.module.mjs +5 -5
- package/esm2022/devkit/localization-devtools.service.mjs +22 -4
- package/esm2022/devkit/localization-devtools.token.mjs +3 -2
- package/esm2022/stores/localization-override/localization-override.module.mjs +5 -5
- package/esm2022/tools/localization-translate.directive.mjs +4 -4
- package/esm2022/tools/localization-translate.pipe.mjs +4 -4
- package/esm2022/tools/localization.module.mjs +5 -5
- package/esm2022/tools/localization.service.mjs +4 -4
- package/esm2022/tools/localized-currency.pipe.mjs +4 -4
- package/esm2022/tools/localized-date.pipe.mjs +4 -4
- package/esm2022/tools/localized-decimal.pipe.mjs +4 -4
- package/esm2022/tools/text-direction.service.mjs +4 -4
- package/esm2022/tools/text-directionality.service.mjs +4 -4
- package/esm2022/tools/translations-loader.mjs +4 -4
- package/fesm2022/o3r-localization.mjs +129 -60
- package/fesm2022/o3r-localization.mjs.map +1 -1
- package/package.json +20 -17
- package/schemas/localization.metadata.schema.json +17 -2
- package/schematics/add-localization-key/index.js.map +1 -0
- package/schematics/add-localization-key/schema.js.map +1 -0
- package/schematics/cms-adapter/index.js.map +1 -0
- package/schematics/localization-base/index.js.map +1 -0
- package/schematics/localization-to-component/index.js.map +1 -0
- package/schematics/localization-to-component/schema.js.map +1 -0
- package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -1
- package/schematics/ng-add/helpers/devtools-registration.js +17 -7
- package/schematics/ng-add/helpers/devtools-registration.js.map +1 -0
- package/schematics/ng-add/index.js.map +1 -0
- package/schematics/ng-add/schema.js.map +1 -0
- package/schematics/package.json +3 -0
|
@@ -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
10
|
import { createAction, props, 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';
|
|
@@ -140,10 +140,10 @@ class TranslateMessageFormatLazyCompiler extends TranslateCompiler {
|
|
|
140
140
|
return Object.keys(translations)
|
|
141
141
|
.reduce(compilingStrategy, {});
|
|
142
142
|
}
|
|
143
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
144
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.
|
|
143
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslateMessageFormatLazyCompiler, deps: [{ token: MESSAGE_FORMAT_CONFIG, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
144
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslateMessageFormatLazyCompiler }); }
|
|
145
145
|
}
|
|
146
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslateMessageFormatLazyCompiler, decorators: [{
|
|
147
147
|
type: Injectable
|
|
148
148
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
149
149
|
type: Optional
|
|
@@ -194,13 +194,13 @@ class LocalizationOverrideStoreModule {
|
|
|
194
194
|
]
|
|
195
195
|
};
|
|
196
196
|
}
|
|
197
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
198
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.
|
|
199
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.
|
|
197
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationOverrideStoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
198
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocalizationOverrideStoreModule, imports: [i3.StoreFeatureModule] }); }
|
|
199
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationOverrideStoreModule, providers: [
|
|
200
200
|
{ provide: LOCALIZATION_OVERRIDE_REDUCER_TOKEN, useFactory: getDefaultLocalizationOverrideReducer }
|
|
201
201
|
], imports: [StoreModule.forFeature(LOCALIZATION_OVERRIDE_STORE_NAME, LOCALIZATION_OVERRIDE_REDUCER_TOKEN)] }); }
|
|
202
202
|
}
|
|
203
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
203
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationOverrideStoreModule, decorators: [{
|
|
204
204
|
type: NgModule,
|
|
205
205
|
args: [{
|
|
206
206
|
imports: [
|
|
@@ -404,10 +404,10 @@ class LocalizationService {
|
|
|
404
404
|
translate(key, interpolateParams) {
|
|
405
405
|
return this.getKey(key).pipe(switchMap((translationKey) => this.getTranslationStream(translationKey, interpolateParams)), shareReplay(1));
|
|
406
406
|
}
|
|
407
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
408
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.
|
|
407
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationService, deps: [{ token: i2.TranslateService }, { token: i1.LoggerService }, { token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i3.Store, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
408
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationService }); }
|
|
409
409
|
}
|
|
410
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
410
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationService, decorators: [{
|
|
411
411
|
type: Injectable
|
|
412
412
|
}], ctorParameters: function () { return [{ type: i2.TranslateService }, { type: i1.LoggerService }, { type: undefined, decorators: [{
|
|
413
413
|
type: Inject,
|
|
@@ -472,10 +472,10 @@ class LocalizationTranslateDirective extends TranslateDirective {
|
|
|
472
472
|
this.onKeyChange?.unsubscribe();
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
476
|
-
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.
|
|
475
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationTranslateDirective, deps: [{ token: LocalizationService }, { token: i2.TranslateService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }, { token: LOCALIZATION_CONFIGURATION_TOKEN }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
476
|
+
/** @nocollapse */ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: LocalizationTranslateDirective, selector: "[translate],[ngx-translate]", inputs: { translate: "translate" }, usesInheritance: true, ngImport: i0 }); }
|
|
477
477
|
}
|
|
478
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
478
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationTranslateDirective, decorators: [{
|
|
479
479
|
type: Directive,
|
|
480
480
|
args: [{
|
|
481
481
|
selector: '[translate],[ngx-translate]'
|
|
@@ -541,10 +541,10 @@ class LocalizationTranslatePipe extends TranslatePipe {
|
|
|
541
541
|
this.onShowKeysChange.unsubscribe();
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
545
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.
|
|
544
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationTranslatePipe, deps: [{ token: LocalizationService }, { token: i2.TranslateService }, { token: i0.ChangeDetectorRef }, { token: LOCALIZATION_CONFIGURATION_TOKEN }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
545
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocalizationTranslatePipe, name: "translate", pure: false }); }
|
|
546
546
|
}
|
|
547
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
547
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationTranslatePipe, decorators: [{
|
|
548
548
|
type: Pipe,
|
|
549
549
|
args: [{ name: 'translate', pure: false }]
|
|
550
550
|
}], ctorParameters: function () { return [{ type: LocalizationService }, { type: i2.TranslateService }, { type: i0.ChangeDetectorRef }, { type: undefined, decorators: [{
|
|
@@ -568,10 +568,10 @@ class LocalizedCurrencyPipe extends CurrencyPipe {
|
|
|
568
568
|
ngOnDestroy() {
|
|
569
569
|
this.onLangChange.unsubscribe();
|
|
570
570
|
}
|
|
571
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
572
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.
|
|
571
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedCurrencyPipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
572
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocalizedCurrencyPipe, name: "currency", pure: false }); }
|
|
573
573
|
}
|
|
574
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
574
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedCurrencyPipe, decorators: [{
|
|
575
575
|
type: Pipe,
|
|
576
576
|
args: [{
|
|
577
577
|
name: 'currency',
|
|
@@ -600,10 +600,10 @@ class LocalizedDatePipe extends DatePipe {
|
|
|
600
600
|
ngOnDestroy() {
|
|
601
601
|
this.onLangChange.unsubscribe();
|
|
602
602
|
}
|
|
603
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
604
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.
|
|
603
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedDatePipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
604
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocalizedDatePipe, name: "date", pure: false }); }
|
|
605
605
|
}
|
|
606
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
606
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedDatePipe, decorators: [{
|
|
607
607
|
type: Pipe,
|
|
608
608
|
args: [{
|
|
609
609
|
name: 'date',
|
|
@@ -627,10 +627,10 @@ class LocalizedDecimalPipe extends DecimalPipe {
|
|
|
627
627
|
ngOnDestroy() {
|
|
628
628
|
this.onLangChange.unsubscribe();
|
|
629
629
|
}
|
|
630
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
631
|
-
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.
|
|
630
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedDecimalPipe, deps: [{ token: LocalizationService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
631
|
+
/** @nocollapse */ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocalizedDecimalPipe, name: "decimal", pure: false }); }
|
|
632
632
|
}
|
|
633
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
633
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizedDecimalPipe, decorators: [{
|
|
634
634
|
type: Pipe,
|
|
635
635
|
args: [{
|
|
636
636
|
name: 'decimal',
|
|
@@ -665,10 +665,10 @@ class TextDirectionService {
|
|
|
665
665
|
});
|
|
666
666
|
return this.subscription;
|
|
667
667
|
}
|
|
668
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
669
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.
|
|
668
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextDirectionService, deps: [{ token: i2.TranslateService }, { token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i0.RendererFactory2 }, { token: i2$1.Directionality }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
669
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextDirectionService }); }
|
|
670
670
|
}
|
|
671
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
671
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextDirectionService, decorators: [{
|
|
672
672
|
type: Injectable
|
|
673
673
|
}], ctorParameters: function () { return [{ type: i2.TranslateService }, { type: undefined, decorators: [{
|
|
674
674
|
type: Inject,
|
|
@@ -685,10 +685,10 @@ class TextDirectionality extends Directionality {
|
|
|
685
685
|
ngOnDestroy() {
|
|
686
686
|
this.change.complete();
|
|
687
687
|
}
|
|
688
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
689
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.
|
|
688
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextDirectionality, deps: [{ token: DIR_DOCUMENT, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
689
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextDirectionality }); }
|
|
690
690
|
}
|
|
691
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
691
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TextDirectionality, decorators: [{
|
|
692
692
|
type: Injectable
|
|
693
693
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
694
694
|
type: Optional
|
|
@@ -741,9 +741,9 @@ class LocalizationModule {
|
|
|
741
741
|
]
|
|
742
742
|
};
|
|
743
743
|
}
|
|
744
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
745
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.
|
|
746
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.
|
|
744
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
745
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocalizationModule, declarations: [LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule], exports: [TranslateModule, LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe] }); }
|
|
746
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationModule, providers: [
|
|
747
747
|
{ provide: LOCALIZATION_CONFIGURATION_TOKEN, useFactory: createLocalizationConfiguration, deps: [[new Optional(), CUSTOM_LOCALIZATION_CONFIGURATION_TOKEN]] },
|
|
748
748
|
{ provide: LOCALE_ID, useFactory: localeIdNgBridge, deps: [LocalizationService] },
|
|
749
749
|
{ provide: Directionality, useClass: TextDirectionality },
|
|
@@ -753,7 +753,7 @@ class LocalizationModule {
|
|
|
753
753
|
TextDirectionService
|
|
754
754
|
], imports: [TranslateModule, BidiModule, DynamicContentModule, CommonModule, TranslateModule] }); }
|
|
755
755
|
}
|
|
756
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
756
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationModule, decorators: [{
|
|
757
757
|
type: NgModule,
|
|
758
758
|
args: [{
|
|
759
759
|
declarations: [LocalizationTranslatePipe, LocalizationTranslateDirective, LocalizedDatePipe, LocalizedDecimalPipe, LocalizedCurrencyPipe],
|
|
@@ -862,10 +862,10 @@ class TranslationsLoader {
|
|
|
862
862
|
}
|
|
863
863
|
}));
|
|
864
864
|
}
|
|
865
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
866
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.
|
|
865
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslationsLoader, deps: [{ token: LOCALIZATION_CONFIGURATION_TOKEN }, { token: i1.LoggerService, optional: true }, { token: i2$2.DynamicContentService, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
866
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslationsLoader }); }
|
|
867
867
|
}
|
|
868
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
868
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: TranslationsLoader, decorators: [{
|
|
869
869
|
type: Injectable
|
|
870
870
|
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
|
871
871
|
type: Inject,
|
|
@@ -908,15 +908,34 @@ class OtterLocalizationDevtools {
|
|
|
908
908
|
showLocalizationKeys(value) {
|
|
909
909
|
this.localizationService.toggleShowKeys(value);
|
|
910
910
|
}
|
|
911
|
-
/**
|
|
912
|
-
|
|
911
|
+
/**
|
|
912
|
+
* Returns the current language
|
|
913
|
+
*/
|
|
914
|
+
getCurrentLanguage() {
|
|
915
|
+
return this.localizationService.getCurrentLanguage();
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Setup a listener on language change
|
|
919
|
+
* @param fn called when the language is changed in the app
|
|
920
|
+
*/
|
|
921
|
+
onLanguageChange(fn) {
|
|
922
|
+
return this.localizationService
|
|
923
|
+
.getTranslateService()
|
|
924
|
+
.onLangChange
|
|
925
|
+
.subscribe(({ lang }) => {
|
|
926
|
+
fn(lang);
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OtterLocalizationDevtools, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
930
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OtterLocalizationDevtools }); }
|
|
913
931
|
}
|
|
914
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
932
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: OtterLocalizationDevtools, decorators: [{
|
|
915
933
|
type: Injectable
|
|
916
934
|
}], ctorParameters: function () { return [{ type: LocalizationService }]; } });
|
|
917
935
|
|
|
918
936
|
const OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS = {
|
|
919
|
-
isActivatedOnBootstrap: false
|
|
937
|
+
isActivatedOnBootstrap: false,
|
|
938
|
+
isActivatedOnBootstrapWhenCMSContext: true
|
|
920
939
|
};
|
|
921
940
|
const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS = new InjectionToken('Otter Localization Devtools options');
|
|
922
941
|
|
|
@@ -924,10 +943,14 @@ const OTTER_LOCALIZATION_DEVTOOLS_OPTIONS = new InjectionToken('Otter Localizati
|
|
|
924
943
|
class LocalizationDevtoolsConsoleService {
|
|
925
944
|
/** Name of the Window property to access to the devtools */
|
|
926
945
|
static { this.windowModuleName = 'localization'; }
|
|
927
|
-
constructor(localizationDevtools, options = OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS) {
|
|
946
|
+
constructor(localizationDevtools, localizationService, appRef, options = OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS) {
|
|
928
947
|
this.localizationDevtools = localizationDevtools;
|
|
948
|
+
this.localizationService = localizationService;
|
|
949
|
+
this.appRef = appRef;
|
|
929
950
|
this.options = options;
|
|
930
|
-
if (this.options.isActivatedOnBootstrap
|
|
951
|
+
if (this.options.isActivatedOnBootstrap
|
|
952
|
+
|| (this.options.isActivatedOnBootstrapWhenCMSContext
|
|
953
|
+
&& document.body.dataset.cmscontext === 'true')) {
|
|
931
954
|
this.activate();
|
|
932
955
|
}
|
|
933
956
|
}
|
|
@@ -941,19 +964,65 @@ class LocalizationDevtoolsConsoleService {
|
|
|
941
964
|
console.info(`Otter localization Devtools is now accessible via the _OTTER_DEVTOOLS_.${LocalizationDevtoolsConsoleService.windowModuleName} variable`);
|
|
942
965
|
}
|
|
943
966
|
/**
|
|
944
|
-
*
|
|
945
|
-
*
|
|
946
|
-
* @param value value enforced by the DevTools extension
|
|
967
|
+
* @inheritdoc
|
|
947
968
|
*/
|
|
948
969
|
showLocalizationKeys(value) {
|
|
949
970
|
this.localizationDevtools.showLocalizationKeys(value);
|
|
971
|
+
this.appRef.tick();
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* @inheritdoc
|
|
975
|
+
*/
|
|
976
|
+
getCurrentLanguage() {
|
|
977
|
+
const currentLanguage = this.localizationDevtools.getCurrentLanguage();
|
|
978
|
+
return currentLanguage;
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* @inheritdoc
|
|
982
|
+
*/
|
|
983
|
+
async switchLanguage(language) {
|
|
984
|
+
const previous = this.localizationDevtools.getCurrentLanguage();
|
|
985
|
+
await lastValueFrom(this.localizationService.useLanguage(language));
|
|
986
|
+
this.appRef.tick();
|
|
987
|
+
const current = this.localizationDevtools.getCurrentLanguage();
|
|
988
|
+
return {
|
|
989
|
+
requested: language,
|
|
990
|
+
previous,
|
|
991
|
+
current
|
|
992
|
+
};
|
|
993
|
+
}
|
|
994
|
+
/**
|
|
995
|
+
* @inheritdoc
|
|
996
|
+
*/
|
|
997
|
+
onLanguageChange(fn) {
|
|
998
|
+
return this.localizationDevtools.onLanguageChange(fn);
|
|
999
|
+
}
|
|
1000
|
+
/**
|
|
1001
|
+
* @inheritdoc
|
|
1002
|
+
*/
|
|
1003
|
+
updateLocalizationKeys(keyValues, language) {
|
|
1004
|
+
Object.entries(keyValues).map(([key, value]) => {
|
|
1005
|
+
this.localizationService.getTranslateService().set(key, value, language || this.localizationDevtools.getCurrentLanguage());
|
|
1006
|
+
});
|
|
1007
|
+
this.appRef.tick();
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* @inheritdoc
|
|
1011
|
+
*/
|
|
1012
|
+
async reloadLocalizationKeys(language) {
|
|
1013
|
+
const lang = language || this.localizationDevtools.getCurrentLanguage();
|
|
1014
|
+
const initialLocs = await lastValueFrom(this.localizationService
|
|
1015
|
+
.getTranslateService()
|
|
1016
|
+
.reloadLang(lang)
|
|
1017
|
+
.pipe(take(1)));
|
|
1018
|
+
return this.updateLocalizationKeys(initialLocs, lang);
|
|
950
1019
|
}
|
|
951
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
952
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.
|
|
1020
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsConsoleService, deps: [{ token: OtterLocalizationDevtools }, { token: LocalizationService }, { token: i0.ApplicationRef }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1021
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsConsoleService }); }
|
|
953
1022
|
}
|
|
954
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
1023
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsConsoleService, decorators: [{
|
|
955
1024
|
type: Injectable
|
|
956
|
-
}], ctorParameters: function () { return [{ type: OtterLocalizationDevtools }, { type: undefined, decorators: [{
|
|
1025
|
+
}], ctorParameters: function () { return [{ type: OtterLocalizationDevtools }, { type: LocalizationService }, { type: i0.ApplicationRef }, { type: undefined, decorators: [{
|
|
957
1026
|
type: Optional
|
|
958
1027
|
}, {
|
|
959
1028
|
type: Inject,
|
|
@@ -1009,10 +1078,10 @@ class LocalizationDevtoolsMessageService {
|
|
|
1009
1078
|
ngOnDestroy() {
|
|
1010
1079
|
this.subscriptions.unsubscribe();
|
|
1011
1080
|
}
|
|
1012
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
1013
|
-
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.
|
|
1081
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsMessageService, deps: [{ token: i1.LoggerService }, { token: OtterLocalizationDevtools }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
1082
|
+
/** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsMessageService }); }
|
|
1014
1083
|
}
|
|
1015
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
1084
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsMessageService, decorators: [{
|
|
1016
1085
|
type: Injectable
|
|
1017
1086
|
}], ctorParameters: function () { return [{ type: i1.LoggerService }, { type: OtterLocalizationDevtools }, { type: undefined, decorators: [{
|
|
1018
1087
|
type: Optional
|
|
@@ -1038,16 +1107,16 @@ class LocalizationDevtoolsModule {
|
|
|
1038
1107
|
]
|
|
1039
1108
|
};
|
|
1040
1109
|
}
|
|
1041
|
-
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.
|
|
1042
|
-
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.
|
|
1043
|
-
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.
|
|
1110
|
+
/** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
1111
|
+
/** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsModule, imports: [LocalizationModule] }); }
|
|
1112
|
+
/** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsModule, providers: [
|
|
1044
1113
|
{ provide: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, useValue: OTTER_LOCALIZATION_DEVTOOLS_DEFAULT_OPTIONS },
|
|
1045
1114
|
LocalizationDevtoolsMessageService,
|
|
1046
1115
|
LocalizationDevtoolsConsoleService,
|
|
1047
1116
|
OtterLocalizationDevtools
|
|
1048
1117
|
], imports: [LocalizationModule] }); }
|
|
1049
1118
|
}
|
|
1050
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.
|
|
1119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: LocalizationDevtoolsModule, decorators: [{
|
|
1051
1120
|
type: NgModule,
|
|
1052
1121
|
args: [{
|
|
1053
1122
|
imports: [
|