@o3r/localization 10.0.0-prerelease.5 → 10.0.0-prerelease.50

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 (51) hide show
  1. package/README.md +7 -7
  2. package/builders/i18n/index.d.ts.map +1 -1
  3. package/builders/i18n/index.js +3 -2
  4. package/builders/localization/index.d.ts.map +1 -1
  5. package/builders/localization/index.js +3 -2
  6. package/builders/localization-extractor/index.d.ts.map +1 -1
  7. package/builders/localization-extractor/index.js +2 -2
  8. package/esm2022/core/translate-messageformat-lazy.compiler.mjs +3 -3
  9. package/esm2022/devkit/localization-devtools.console.service.mjs +3 -3
  10. package/esm2022/devkit/localization-devtools.message.service.mjs +3 -3
  11. package/esm2022/devkit/localization-devtools.module.mjs +4 -4
  12. package/esm2022/devkit/localization-devtools.service.mjs +3 -3
  13. package/esm2022/rules-engine/localization.handler-action.mjs +3 -3
  14. package/esm2022/rules-engine/localization.rules-engine.module.mjs +4 -4
  15. package/esm2022/stores/localization-override/localization-override.module.mjs +4 -4
  16. package/esm2022/tools/localization-translate.directive.mjs +3 -3
  17. package/esm2022/tools/localization-translate.pipe.mjs +18 -6
  18. package/esm2022/tools/localization.module.mjs +8 -8
  19. package/esm2022/tools/localization.service.mjs +3 -3
  20. package/esm2022/tools/localized-currency.pipe.mjs +3 -3
  21. package/esm2022/tools/localized-date.pipe.mjs +3 -3
  22. package/esm2022/tools/localized-decimal.pipe.mjs +3 -3
  23. package/esm2022/tools/text-direction.service.mjs +3 -3
  24. package/esm2022/tools/text-directionality.service.mjs +3 -3
  25. package/esm2022/tools/translations-loader.mjs +3 -3
  26. package/fesm2022/o3r-localization-rules-engine.mjs +7 -7
  27. package/fesm2022/o3r-localization.mjs +69 -57
  28. package/fesm2022/o3r-localization.mjs.map +1 -1
  29. package/migration.json +10 -0
  30. package/package.json +7 -7
  31. package/schematics/add-localization-key/index.d.ts +6 -2
  32. package/schematics/add-localization-key/index.d.ts.map +1 -1
  33. package/schematics/add-localization-key/index.js +12 -8
  34. package/schematics/cms-adapter/index.d.ts +2 -3
  35. package/schematics/cms-adapter/index.d.ts.map +1 -1
  36. package/schematics/cms-adapter/index.js +7 -3
  37. package/schematics/localization-base/index.d.ts +2 -7
  38. package/schematics/localization-base/index.d.ts.map +1 -1
  39. package/schematics/localization-base/index.js +2 -2
  40. package/schematics/localization-to-component/index.d.ts +6 -2
  41. package/schematics/localization-to-component/index.d.ts.map +1 -1
  42. package/schematics/localization-to-component/index.js +10 -6
  43. package/schematics/ng-add/index.d.ts +1 -1
  44. package/schematics/ng-add/index.d.ts.map +1 -1
  45. package/schematics/ng-add/index.js +6 -2
  46. package/schematics/ng-update/v10-0/index.d.ts +6 -0
  47. package/schematics/ng-update/v10-0/index.d.ts.map +1 -0
  48. package/schematics/ng-update/v10-0/index.js +30 -0
  49. package/tools/localization-translate.pipe.d.ts +18 -9
  50. package/tools/localization-translate.pipe.d.ts.map +1 -1
  51. package/tools/localization.module.d.ts +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AA+B7I;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAgb/G;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAC,GAAG,IAAI,CAwC5E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-base/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsD,IAAI,EAAyC,MAAM,4BAA4B,CAAC;AAgC7I;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAgb/G;AAiDD,eAAO,MAAM,UAAU;kBA1CuB,MAAM,GAAG,SAAS;UA0Ca,CAAC"}
@@ -367,7 +367,7 @@ exports.updateLocalization = updateLocalization;
367
367
  * @param options
368
368
  * @param options.projectName
369
369
  */
370
- function updateI18n(options) {
370
+ function updateI18nFn(options) {
371
371
  if (!options.projectName) {
372
372
  return schematics_1.noop;
373
373
  }
@@ -403,5 +403,5 @@ function updateI18n(options) {
403
403
  updateAngularJson
404
404
  ]);
405
405
  }
406
- exports.updateI18n = updateI18n;
406
+ exports.updateI18n = (0, schematics_2.createSchematicWithMetricsIfInstalled)(updateI18nFn);
407
407
  //# sourceMappingURL=index.js.map
@@ -2,8 +2,12 @@ import { Rule } from '@angular-devkit/schematics';
2
2
  import type { NgAddLocalizationSchematicsSchema } from './schema';
3
3
  /**
4
4
  * Add localization architecture to an existing component
5
- *
6
5
  * @param options
7
6
  */
8
- export declare function ngAddLocalization(options: NgAddLocalizationSchematicsSchema): Rule;
7
+ export declare function ngAddLocalizationFn(options: NgAddLocalizationSchematicsSchema): Rule;
8
+ /**
9
+ * Add localization architecture to an existing component
10
+ * @param options
11
+ */
12
+ export declare const ngAddLocalization: (options: NgAddLocalizationSchematicsSchema) => Rule;
9
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-to-component/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,IAAI,EAML,MAAM,4BAA4B,CAAC;AAqBpC,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAkClE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iCAAiC,GAAG,IAAI,CA6SlF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/localization-to-component/index.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,IAAI,EAML,MAAM,4BAA4B,CAAC;AAsBpC,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAC;AAkClE;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,iCAAiC,GAAG,IAAI,CA6SpF;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,sDAA6D,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ngAddLocalization = void 0;
3
+ exports.ngAddLocalization = exports.ngAddLocalizationFn = void 0;
4
4
  const schematics_1 = require("@angular-devkit/schematics");
5
5
  const schematics_2 = require("@o3r/schematics");
6
6
  const ast_utils_1 = require("@schematics/angular/utility/ast-utils");
@@ -29,10 +29,9 @@ const checkLocalization = (componentPath, tree, baseFileName) => {
29
29
  };
30
30
  /**
31
31
  * Add localization architecture to an existing component
32
- *
33
32
  * @param options
34
33
  */
35
- function ngAddLocalization(options) {
34
+ function ngAddLocalizationFn(options) {
36
35
  return async (tree, context) => {
37
36
  try {
38
37
  const baseFileName = (0, node_path_1.basename)(options.path, '.component.ts');
@@ -131,7 +130,7 @@ function ngAddLocalization(options) {
131
130
  if (templatePath && tree.exists(templatePath)) {
132
131
  tree.commitUpdate(tree
133
132
  .beginUpdate(templatePath)
134
- .insertLeft(0, '<div>Localization: {{ translations.dummyLoc1 | translate }}</div>\n'));
133
+ .insertLeft(0, '<div>Localization: {{ translations.dummyLoc1 | o3rTranslate }}</div>\n'));
135
134
  }
136
135
  return tree;
137
136
  };
@@ -231,7 +230,7 @@ const mockTranslationsCompilerProvider: Provider = {
231
230
  (0, schematics_1.externalSchematic)('@o3r/core', 'convert-component', {
232
231
  path: options.path
233
232
  }),
234
- ngAddLocalization(options)
233
+ ngAddLocalizationFn(options)
235
234
  ]);
236
235
  }
237
236
  }
@@ -239,5 +238,10 @@ const mockTranslationsCompilerProvider: Provider = {
239
238
  }
240
239
  };
241
240
  }
242
- exports.ngAddLocalization = ngAddLocalization;
241
+ exports.ngAddLocalizationFn = ngAddLocalizationFn;
242
+ /**
243
+ * Add localization architecture to an existing component
244
+ * @param options
245
+ */
246
+ exports.ngAddLocalization = (0, schematics_2.createSchematicWithMetricsIfInstalled)(ngAddLocalizationFn);
243
247
  //# sourceMappingURL=index.js.map
@@ -4,5 +4,5 @@ import type { NgAddSchematicsSchema } from './schema';
4
4
  * Add Otter localization to an Angular Project
5
5
  * @param options for the dependencies installations
6
6
  */
7
- export declare function ngAdd(options: NgAddSchematicsSchema): Rule;
7
+ export declare const ngAdd: (options: NgAddSchematicsSchema) => Rule;
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAKvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAGtD;;;GAGG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,qBAAqB,GAAG,IAAI,CAsD1D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../schematics/ng-add/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AAKvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AA+DtD;;;GAGG;AACH,eAAO,MAAM,KAAK,0CAAiD,CAAC"}
@@ -11,7 +11,7 @@ const devtools_registration_1 = require("./helpers/devtools-registration");
11
11
  * Add Otter localization to an Angular Project
12
12
  * @param options for the dependencies installations
13
13
  */
14
- function ngAdd(options) {
14
+ function ngAddFn(options) {
15
15
  return async (tree, context) => {
16
16
  try {
17
17
  const { applyEsLintFix, install, getProjectNewDependenciesType, getWorkspaceConfig, ngAddPackages, ngAddPeerDependencyPackages, getO3rPeerDeps } = await Promise.resolve().then(() => require('@o3r/schematics'));
@@ -66,5 +66,9 @@ function ngAdd(options) {
66
66
  }
67
67
  };
68
68
  }
69
- exports.ngAdd = ngAdd;
69
+ /**
70
+ * Add Otter localization to an Angular Project
71
+ * @param options for the dependencies installations
72
+ */
73
+ exports.ngAdd = (0, schematics_2.createSchematicWithMetricsIfInstalled)(ngAddFn);
70
74
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ import { Rule } from '@angular-devkit/schematics';
2
+ /**
3
+ * Update of Otter library V10.0
4
+ */
5
+ export declare const updateV10_0: (options: unknown) => Rule;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-update/v10-0/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,IAAI,EAA0B,MAAM,4BAA4B,CAAC;AA0BjF;;GAEG;AACH,eAAO,MAAM,WAAW,4BAAuD,CAAC"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateV10_0 = void 0;
4
+ /* eslint-disable camelcase, @typescript-eslint/naming-convention */
5
+ const schematics_1 = require("@angular-devkit/schematics");
6
+ const schematics_2 = require("@o3r/schematics");
7
+ const pipeReplacementInfo = {
8
+ translate: {
9
+ new: {
10
+ name: 'o3rTranslate'
11
+ },
12
+ import: 'LocalizationModule'
13
+ }
14
+ };
15
+ /**
16
+ * Update of Otter library V10.0
17
+ */
18
+ function updateV10_0Fn() {
19
+ return (tree, context) => {
20
+ const updateRules = [
21
+ (0, schematics_2.updatePipes)(pipeReplacementInfo)
22
+ ];
23
+ return (0, schematics_1.chain)(updateRules)(tree, context);
24
+ };
25
+ }
26
+ /**
27
+ * Update of Otter library V10.0
28
+ */
29
+ exports.updateV10_0 = (0, schematics_2.createSchematicWithMetricsIfInstalled)(updateV10_0Fn);
30
+ //# sourceMappingURL=index.js.map
@@ -1,31 +1,32 @@
1
1
  import { ChangeDetectorRef, PipeTransform } from '@angular/core';
2
2
  import { TranslatePipe, TranslateService } from '@ngx-translate/core';
3
+ import { Subscription } from 'rxjs';
3
4
  import { LocalizationConfiguration } from '../core';
4
5
  import { LocalizationService } from './localization.service';
5
6
  import * as i0 from "@angular/core";
6
7
  /**
7
8
  * TranslatePipe class adding debug functionality
8
9
  */
9
- export declare class LocalizationTranslatePipe extends TranslatePipe implements PipeTransform {
10
- private readonly localizationService;
11
- private readonly changeDetector;
12
- private readonly localizationConfig;
10
+ export declare class O3rLocalizationTranslatePipe extends TranslatePipe implements PipeTransform {
11
+ protected readonly localizationService: LocalizationService;
12
+ protected readonly changeDetector: ChangeDetectorRef;
13
+ protected readonly localizationConfig: LocalizationConfiguration;
13
14
  /**
14
15
  * Internal subscription to the LocalizationService showKeys mode changes
15
16
  */
16
- private readonly onShowKeysChange?;
17
+ protected readonly onShowKeysChange?: Subscription;
17
18
  /**
18
19
  * Internal subscription to the LocalizationService key mapping
19
20
  */
20
- private onKeyChange?;
21
+ protected onKeyChange?: Subscription;
21
22
  /**
22
23
  * Should we display keys instead of translations
23
24
  */
24
- private showKeys;
25
+ protected showKeys: boolean;
25
26
  /** last key queried */
26
- private lastQueryKey?;
27
+ protected lastQueryKey?: string;
27
28
  /** last key resolved */
28
- private lastResolvedKey?;
29
+ protected lastResolvedKey?: string;
29
30
  constructor(localizationService: LocalizationService, translateService: TranslateService, changeDetector: ChangeDetectorRef, localizationConfig: LocalizationConfiguration);
30
31
  /**
31
32
  * Calls original transform method and eventually outputs the key if debugMode (in LocalizationConfiguration) is enabled
@@ -33,6 +34,14 @@ export declare class LocalizationTranslatePipe extends TranslatePipe implements
33
34
  */
34
35
  transform(query: string, ...args: any[]): any;
35
36
  ngOnDestroy(): void;
37
+ static ɵfac: i0.ɵɵFactoryDeclaration<O3rLocalizationTranslatePipe, never>;
38
+ static ɵpipe: i0.ɵɵPipeDeclaration<O3rLocalizationTranslatePipe, "o3rTranslate", false>;
39
+ }
40
+ /**
41
+ * TranslatePipe class adding debug functionality
42
+ * @deprecated please use O3rLocalizationTranslatePipe, will be removed in v12.
43
+ */
44
+ export declare class LocalizationTranslatePipe extends O3rLocalizationTranslatePipe implements PipeTransform {
36
45
  static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationTranslatePipe, never>;
37
46
  static ɵpipe: i0.ɵɵPipeDeclaration<LocalizationTranslatePipe, "translate", false>;
38
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"localization-translate.pipe.d.ts","sourceRoot":"","sources":["../../src/tools/localization-translate.pipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAgB,aAAa,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;;AAE7D;;GAEG;AACH,qBACa,yBAA0B,SAAQ,aAAc,YAAW,aAAa;IAsBvE,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAA2D,OAAO,CAAC,QAAQ,CAAC,cAAc;IACpF,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IAtBzF;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAe;IAEjD;;OAEG;IACH,OAAO,CAAC,WAAW,CAAC,CAAe;IAEnC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAS;IAEzB,uBAAuB;IACvB,OAAO,CAAC,YAAY,CAAC,CAAS;IAE9B,wBAAwB;IACxB,OAAO,CAAC,eAAe,CAAC,CAAS;gBAEJ,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,gBAAgB,EAAmB,cAAc,EAAE,iBAAiB,EACtF,kBAAkB,EAAE,yBAAyB;IAWpH;;;OAGG;IACI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E,GAAG,EAAE,GAAG,GAAG;IA8B7C,WAAW;yCApEP,4BAA4B;uCAA5B,4BAA4B;CA0ExC;AAED;;;GAGG;AACH,qBACa,yBAA0B,SAAQ,4BAA6B,YAAW,aAAa;yCAAvF,yBAAyB;uCAAzB,yBAAyB;CAAiE"}
@@ -35,7 +35,7 @@ export declare class LocalizationModule {
35
35
  */
36
36
  static forRoot(configuration?: () => Partial<LocalizationConfiguration>): ModuleWithProviders<LocalizationModule>;
37
37
  static ɵfac: i0.ɵɵFactoryDeclaration<LocalizationModule, never>;
38
- static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationModule, [typeof i1.LocalizationTranslatePipe, typeof i2.LocalizationTranslateDirective, typeof i3.LocalizedDatePipe, typeof i4.LocalizedDecimalPipe, typeof i5.LocalizedCurrencyPipe], [typeof i6.TranslateModule, typeof i7.BidiModule, typeof i8.DynamicContentModule, typeof i9.CommonModule], [typeof i6.TranslateModule, typeof i1.LocalizationTranslatePipe, typeof i2.LocalizationTranslateDirective, typeof i3.LocalizedDatePipe, typeof i4.LocalizedDecimalPipe, typeof i5.LocalizedCurrencyPipe]>;
38
+ static ɵmod: i0.ɵɵNgModuleDeclaration<LocalizationModule, [typeof i1.O3rLocalizationTranslatePipe, typeof i1.LocalizationTranslatePipe, typeof i2.LocalizationTranslateDirective, typeof i3.LocalizedDatePipe, typeof i4.LocalizedDecimalPipe, typeof i5.LocalizedCurrencyPipe], [typeof i6.TranslateModule, typeof i7.BidiModule, typeof i8.DynamicContentModule, typeof i9.CommonModule], [typeof i6.TranslateModule, typeof i1.O3rLocalizationTranslatePipe, typeof i1.LocalizationTranslatePipe, typeof i2.LocalizationTranslateDirective, typeof i3.LocalizedDatePipe, typeof i4.LocalizedDecimalPipe, typeof i5.LocalizedCurrencyPipe]>;
39
39
  static ɵinj: i0.ɵɵInjectorDeclaration<LocalizationModule>;
40
40
  }
41
41
  //# sourceMappingURL=localization.module.d.ts.map