@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.
Files changed (58) hide show
  1. package/README.md +11 -11
  2. package/builders/helpers/localization.generator.d.ts.map +1 -1
  3. package/builders/helpers/localization.generator.js +8 -3
  4. package/builders/helpers/localization.generator.js.map +1 -0
  5. package/builders/i18n/index.js.map +1 -0
  6. package/builders/i18n/schema.js.map +1 -0
  7. package/builders/localization/index.js +2 -2
  8. package/builders/localization/index.js.map +1 -0
  9. package/builders/localization/schema.js.map +1 -0
  10. package/builders/localization-extractor/index.d.ts.map +1 -1
  11. package/builders/localization-extractor/index.js +2 -0
  12. package/builders/localization-extractor/index.js.map +1 -0
  13. package/builders/localization-extractor/schema.d.ts +2 -0
  14. package/builders/localization-extractor/schema.d.ts.map +1 -1
  15. package/builders/localization-extractor/schema.js.map +1 -0
  16. package/builders/localization-extractor/schema.json +5 -0
  17. package/builders/localization-extractor/validations.js.map +1 -0
  18. package/devkit/localization-devkit.interface.d.ts +45 -2
  19. package/devkit/localization-devkit.interface.d.ts.map +1 -1
  20. package/devkit/localization-devtools.console.service.d.ts +37 -8
  21. package/devkit/localization-devtools.console.service.d.ts.map +1 -1
  22. package/devkit/localization-devtools.service.d.ts +10 -0
  23. package/devkit/localization-devtools.service.d.ts.map +1 -1
  24. package/devkit/localization-devtools.token.d.ts.map +1 -1
  25. package/esm2022/core/translate-messageformat-lazy.compiler.mjs +4 -4
  26. package/esm2022/devkit/localization-devkit.interface.mjs +1 -1
  27. package/esm2022/devkit/localization-devtools.console.service.mjs +65 -11
  28. package/esm2022/devkit/localization-devtools.message.service.mjs +4 -4
  29. package/esm2022/devkit/localization-devtools.module.mjs +5 -5
  30. package/esm2022/devkit/localization-devtools.service.mjs +22 -4
  31. package/esm2022/devkit/localization-devtools.token.mjs +3 -2
  32. package/esm2022/stores/localization-override/localization-override.module.mjs +5 -5
  33. package/esm2022/tools/localization-translate.directive.mjs +4 -4
  34. package/esm2022/tools/localization-translate.pipe.mjs +4 -4
  35. package/esm2022/tools/localization.module.mjs +5 -5
  36. package/esm2022/tools/localization.service.mjs +4 -4
  37. package/esm2022/tools/localized-currency.pipe.mjs +4 -4
  38. package/esm2022/tools/localized-date.pipe.mjs +4 -4
  39. package/esm2022/tools/localized-decimal.pipe.mjs +4 -4
  40. package/esm2022/tools/text-direction.service.mjs +4 -4
  41. package/esm2022/tools/text-directionality.service.mjs +4 -4
  42. package/esm2022/tools/translations-loader.mjs +4 -4
  43. package/fesm2022/o3r-localization.mjs +129 -60
  44. package/fesm2022/o3r-localization.mjs.map +1 -1
  45. package/package.json +20 -17
  46. package/schemas/localization.metadata.schema.json +17 -2
  47. package/schematics/add-localization-key/index.js.map +1 -0
  48. package/schematics/add-localization-key/schema.js.map +1 -0
  49. package/schematics/cms-adapter/index.js.map +1 -0
  50. package/schematics/localization-base/index.js.map +1 -0
  51. package/schematics/localization-to-component/index.js.map +1 -0
  52. package/schematics/localization-to-component/schema.js.map +1 -0
  53. package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -1
  54. package/schematics/ng-add/helpers/devtools-registration.js +17 -7
  55. package/schematics/ng-add/helpers/devtools-registration.js.map +1 -0
  56. package/schematics/ng-add/index.js.map +1 -0
  57. package/schematics/ng-add/schema.js.map +1 -0
  58. 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.0", 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.0", ngImport: i0, type: TranslateMessageFormatLazyCompiler }); }
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.0", ngImport: i0, type: TranslateMessageFormatLazyCompiler, decorators: [{
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.0", ngImport: i0, type: LocalizationOverrideStoreModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
198
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.0", ngImport: i0, type: LocalizationOverrideStoreModule, imports: [i3.StoreFeatureModule] }); }
199
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: LocalizationOverrideStoreModule, providers: [
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.0", ngImport: i0, type: LocalizationOverrideStoreModule, decorators: [{
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.0", 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.0", ngImport: i0, type: LocalizationService }); }
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.0", ngImport: i0, type: LocalizationService, decorators: [{
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.0", 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.0", type: LocalizationTranslateDirective, selector: "[translate],[ngx-translate]", inputs: { translate: "translate" }, usesInheritance: true, ngImport: i0 }); }
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.0", ngImport: i0, type: LocalizationTranslateDirective, decorators: [{
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.0", 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.0", ngImport: i0, type: LocalizationTranslatePipe, name: "translate", pure: false }); }
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.0", ngImport: i0, type: LocalizationTranslatePipe, decorators: [{
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.0", 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.0", ngImport: i0, type: LocalizedCurrencyPipe, name: "currency", pure: false }); }
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.0", ngImport: i0, type: LocalizedCurrencyPipe, decorators: [{
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.0", 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.0", ngImport: i0, type: LocalizedDatePipe, name: "date", pure: false }); }
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.0", ngImport: i0, type: LocalizedDatePipe, decorators: [{
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.0", 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.0", ngImport: i0, type: LocalizedDecimalPipe, name: "decimal", pure: false }); }
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.0", ngImport: i0, type: LocalizedDecimalPipe, decorators: [{
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.0", 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.0", ngImport: i0, type: TextDirectionService }); }
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.0", ngImport: i0, type: TextDirectionService, decorators: [{
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.0", 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.0", ngImport: i0, type: TextDirectionality }); }
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.0", ngImport: i0, type: TextDirectionality, decorators: [{
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.0", ngImport: i0, type: LocalizationModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
745
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.0", 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.0", ngImport: i0, type: LocalizationModule, providers: [
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.0", ngImport: i0, type: LocalizationModule, decorators: [{
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.0", 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.0", ngImport: i0, type: TranslationsLoader }); }
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.0", ngImport: i0, type: TranslationsLoader, decorators: [{
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
- /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: OtterLocalizationDevtools, deps: [{ token: LocalizationService }], target: i0.ɵɵFactoryTarget.Injectable }); }
912
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: OtterLocalizationDevtools }); }
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.0", ngImport: i0, type: OtterLocalizationDevtools, decorators: [{
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
- * Show localization keys
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.0", ngImport: i0, type: LocalizationDevtoolsConsoleService, deps: [{ token: OtterLocalizationDevtools }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
952
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: LocalizationDevtoolsConsoleService }); }
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.0", ngImport: i0, type: LocalizationDevtoolsConsoleService, decorators: [{
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.0", ngImport: i0, type: LocalizationDevtoolsMessageService, deps: [{ token: i1.LoggerService }, { token: OtterLocalizationDevtools }, { token: OTTER_LOCALIZATION_DEVTOOLS_OPTIONS, optional: true }], target: i0.ɵɵFactoryTarget.Injectable }); }
1013
- /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: LocalizationDevtoolsMessageService }); }
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.0", ngImport: i0, type: LocalizationDevtoolsMessageService, decorators: [{
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.0", ngImport: i0, type: LocalizationDevtoolsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
1042
- /** @nocollapse */ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.0", ngImport: i0, type: LocalizationDevtoolsModule, imports: [LocalizationModule] }); }
1043
- /** @nocollapse */ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.0", ngImport: i0, type: LocalizationDevtoolsModule, providers: [
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.0", ngImport: i0, type: LocalizationDevtoolsModule, decorators: [{
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: [