@o3r/localization 10.0.0-next.8 → 11.0.0-next.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 +12 -14
- package/annotations/index.d.ts +0 -1
- package/annotations/index.d.ts.map +1 -1
- package/annotations/localization.d.ts +0 -1
- package/annotations/localization.d.ts.map +1 -1
- package/builders/helpers/localization.generator.d.ts +6 -22
- package/builders/helpers/localization.generator.d.ts.map +1 -1
- package/builders/helpers/localization.generator.js +56 -57
- package/builders/helpers/localization.generator.js.map +1 -1
- package/builders/i18n/schema.json +1 -1
- package/builders/localization/index.d.ts.map +1 -1
- package/builders/localization/index.js +5 -4
- package/builders/localization/index.js.map +1 -1
- package/builders/localization/schema.json +1 -1
- package/builders/localization-extractor/index.d.ts.map +1 -1
- package/builders/localization-extractor/index.js +5 -3
- package/builders/localization-extractor/index.js.map +1 -1
- package/builders/localization-extractor/schema.d.ts +2 -0
- package/builders/localization-extractor/schema.d.ts.map +1 -1
- package/builders/localization-extractor/schema.json +6 -1
- package/core/localization.configuration.d.ts +8 -5
- package/core/localization.configuration.d.ts.map +1 -1
- package/core/translate-messageformat-lazy.compiler.d.ts +1 -3
- package/core/translate-messageformat-lazy.compiler.d.ts.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 +38 -9
- package/devkit/localization-devtools.console.service.d.ts.map +1 -1
- package/devkit/localization-devtools.message.service.d.ts +4 -5
- package/devkit/localization-devtools.message.service.d.ts.map +1 -1
- package/devkit/localization-devtools.module.d.ts +0 -1
- package/devkit/localization-devtools.module.d.ts.map +1 -1
- package/devkit/localization-devtools.service.d.ts +11 -2
- package/devkit/localization-devtools.service.d.ts.map +1 -1
- package/devkit/localization-devtools.token.d.ts.map +1 -1
- package/esm2022/annotations/index.mjs +1 -2
- package/esm2022/annotations/localization.mjs +1 -2
- package/esm2022/core/localization.configuration.mjs +1 -1
- package/esm2022/core/translate-messageformat-lazy.compiler.mjs +6 -6
- package/esm2022/devkit/localization-devkit.interface.mjs +1 -1
- package/esm2022/devkit/localization-devtools.console.service.mjs +66 -12
- package/esm2022/devkit/localization-devtools.message.service.mjs +6 -7
- package/esm2022/devkit/localization-devtools.module.mjs +5 -6
- package/esm2022/devkit/localization-devtools.service.mjs +23 -6
- package/esm2022/devkit/localization-devtools.token.mjs +3 -2
- package/esm2022/rules-engine/localization.handler-action.mjs +30 -0
- package/esm2022/rules-engine/localization.interfaces.mjs +3 -0
- package/esm2022/rules-engine/localization.rules-engine.module.mjs +23 -0
- package/esm2022/rules-engine/o3r-localization-rules-engine.mjs +5 -0
- package/esm2022/rules-engine/public_api.mjs +4 -0
- package/esm2022/stores/localization-override/localization-override.module.mjs +4 -4
- package/esm2022/tools/localization-translate.directive.mjs +6 -7
- package/esm2022/tools/localization-translate.pipe.mjs +6 -7
- package/esm2022/tools/localization.module.mjs +9 -12
- package/esm2022/tools/localization.provider.mjs +1 -2
- package/esm2022/tools/localization.service.mjs +7 -14
- package/esm2022/tools/localized-currency.pipe.mjs +5 -5
- package/esm2022/tools/localized-date.pipe.mjs +5 -5
- package/esm2022/tools/localized-decimal.pipe.mjs +5 -5
- package/esm2022/tools/text-direction.service.mjs +6 -7
- package/esm2022/tools/text-directionality.service.mjs +6 -6
- package/esm2022/tools/translations-loader.mjs +9 -11
- package/fesm2022/o3r-localization-rules-engine.mjs +57 -0
- package/fesm2022/o3r-localization-rules-engine.mjs.map +1 -0
- package/fesm2022/o3r-localization.mjs +160 -139
- package/fesm2022/o3r-localization.mjs.map +1 -1
- package/package.json +40 -30
- package/rules-engine/index.d.ts +6 -0
- package/rules-engine/localization.handler-action.d.ts +19 -0
- package/rules-engine/localization.handler-action.d.ts.map +1 -0
- package/rules-engine/localization.interfaces.d.ts +12 -0
- package/rules-engine/localization.interfaces.d.ts.map +1 -0
- package/rules-engine/localization.rules-engine.module.d.ts +8 -0
- package/rules-engine/localization.rules-engine.module.d.ts.map +1 -0
- package/rules-engine/o3r-localization-rules-engine.d.ts.map +1 -0
- package/rules-engine/public_api.d.ts +4 -0
- package/rules-engine/public_api.d.ts.map +1 -0
- package/schemas/localization.metadata.schema.json +18 -3
- package/schemas/rules-engine.localisation-action.schema.json +26 -0
- package/schematics/add-localization-key/index.d.ts.map +1 -1
- package/schematics/add-localization-key/index.js +2 -2
- package/schematics/add-localization-key/index.js.map +1 -1
- package/schematics/add-localization-key/schema.json +1 -1
- package/schematics/cms-adapter/index.d.ts +0 -1
- package/schematics/cms-adapter/index.d.ts.map +1 -1
- package/schematics/cms-adapter/index.js +5 -9
- package/schematics/cms-adapter/index.js.map +1 -1
- package/schematics/localization-base/index.d.ts +2 -1
- package/schematics/localization-base/index.d.ts.map +1 -1
- package/schematics/localization-base/index.js +28 -34
- package/schematics/localization-base/index.js.map +1 -1
- package/schematics/localization-to-component/index.d.ts.map +1 -1
- package/schematics/localization-to-component/index.js +2 -2
- package/schematics/localization-to-component/index.js.map +1 -1
- package/schematics/localization-to-component/schema.json +1 -1
- package/schematics/ng-add/helpers/devtools-registration.d.ts +11 -0
- package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -0
- package/schematics/ng-add/helpers/devtools-registration.js +35 -0
- package/schematics/ng-add/helpers/devtools-registration.js.map +1 -0
- package/schematics/ng-add/index.d.ts +0 -1
- package/schematics/ng-add/index.d.ts.map +1 -1
- package/schematics/ng-add/index.js +9 -5
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-add/schema.json +1 -1
- package/tools/localization-translate.directive.d.ts +3 -4
- package/tools/localization-translate.directive.d.ts.map +1 -1
- package/tools/localization-translate.pipe.d.ts +4 -5
- package/tools/localization-translate.pipe.d.ts.map +1 -1
- package/tools/localization.module.d.ts +4 -7
- package/tools/localization.module.d.ts.map +1 -1
- package/tools/localization.provider.d.ts +0 -1
- package/tools/localization.provider.d.ts.map +1 -1
- package/tools/localization.service.d.ts +6 -14
- package/tools/localization.service.d.ts.map +1 -1
- package/tools/localized-currency.pipe.d.ts +6 -5
- package/tools/localized-currency.pipe.d.ts.map +1 -1
- package/tools/localized-date.pipe.d.ts +3 -3
- package/tools/localized-date.pipe.d.ts.map +1 -1
- package/tools/localized-decimal.pipe.d.ts +3 -3
- package/tools/localized-decimal.pipe.d.ts.map +1 -1
- package/tools/text-direction.service.d.ts +5 -6
- package/tools/text-direction.service.d.ts.map +1 -1
- package/tools/text-directionality.service.d.ts +0 -1
- package/tools/text-directionality.service.d.ts.map +1 -1
- package/tools/translations-loader.d.ts +5 -7
- package/tools/translations-loader.d.ts.map +1 -1
- package/annotations/input-merge.d.ts +0 -9
- package/annotations/input-merge.d.ts.map +0 -1
- package/builders/package.json +0 -3
- package/esm2022/annotations/input-merge.mjs +0 -29
- package/schematics/package.json +0 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<h1 align="center">Otter localization</h1>
|
|
2
2
|
<p align="center">
|
|
3
|
-
<img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main
|
|
3
|
+
<img src="https://raw.githubusercontent.com/AmadeusITGroup/otter/main/assets/logo/otter.png" alt="Super cute Otter!" width="40%"/>
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
6
|
This package is an [Otter Framework Module](https://github.com/AmadeusITGroup/otter/tree/main/docs/core/MODULE.md).
|
|
@@ -29,7 +29,7 @@ ng add @o3r/localization
|
|
|
29
29
|
|
|
30
30
|
- Fallback language. In case some resource key does not exist in language X, the loader tries to fetch translation bundle from the endpoint location in fallback language Y in the first place and ends by loading json bundles from the application (root of dist folder **/** by default) if previous steps have failed (bundles output path in dist folder is also configurable via a shell option).
|
|
31
31
|
|
|
32
|
-
- Resource keys can be translated from templates (*.html) via a [pipe](https://github.com/ngx-translate/core/blob/master/
|
|
32
|
+
- Resource keys can be translated from templates (*.html) via a [pipe](https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.pipe.ts) or [directive](https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.directive.ts) as well as from typescript (*.ts) via a [service](https://github.com/ngx-translate/core/blob/master/packages/core/lib/translate.service.ts).
|
|
33
33
|
|
|
34
34
|
- Support for resource keys with parameters
|
|
35
35
|
|
|
@@ -371,8 +371,6 @@ constructor(private router: Router,
|
|
|
371
371
|
|
|
372
372
|
### How to add RTL support in my app
|
|
373
373
|
|
|
374
|
-
- Note: **TextDirectionDirective** is deprecated. Please refer to **TextDirectionService**.
|
|
375
|
-
|
|
376
374
|
The **TextDirectionService** has to be injected in `app.component.ts` as follows.
|
|
377
375
|
|
|
378
376
|
```typescript
|
|
@@ -399,7 +397,7 @@ import {
|
|
|
399
397
|
LazyMessageFormatConfig,
|
|
400
398
|
LocalizationModule,
|
|
401
399
|
translateLoaderProvider,
|
|
402
|
-
TranslateMessageFormatLazyCompiler
|
|
400
|
+
TranslateMessageFormatLazyCompiler
|
|
403
401
|
} from "@o3r/localization";
|
|
404
402
|
import { TranslateModule } from "@ngx-translate/core";
|
|
405
403
|
import { MESSAGE_FORMAT_CONFIG } from 'ngx-translate-messageformat-compiler';
|
|
@@ -439,8 +437,8 @@ class AppModule {}
|
|
|
439
437
|
|
|
440
438
|
### How to localize plural expression
|
|
441
439
|
|
|
442
|
-
For pluralizations we are using *TranslateMessageFormatCompiler*, comming from [ngx-translate-messageformat-compiler](https://www.npmjs.com/package/ngx-translate-messageformat-compiler) package, which is a compiler for *ngx-translate* that uses *messageformat.js* to compile translations using ICU syntax for handling pluralization and gender.
|
|
443
|
-
[ICU Message Format](http://userguide.icu-project.org/formatparse/messages) is a standardized syntax for dealing with the translation of user-visible strings into various languages that may have different requirements for the correct declension of words (e.g. according to number, gender, case) - or to simplify: pluralization.
|
|
440
|
+
For pluralizations we are using *TranslateMessageFormatCompiler*, comming from [ngx-translate-messageformat-compiler](https://www.npmjs.com/package/ngx-translate-messageformat-compiler) package, which is a compiler for *ngx-translate* that uses *messageformat.js* to compile translations using ICU syntax for handling pluralization and gender.
|
|
441
|
+
[ICU Message Format](http://userguide.icu-project.org/formatparse/messages) is a standardized syntax for dealing with the translation of user-visible strings into various languages that may have different requirements for the correct declension of words (e.g. according to number, gender, case) - or to simplify: pluralization.
|
|
444
442
|
Simple pluralization rules like *0, 1 or other* fits well for English but may not fit for many other languages (eastern Europe languages, asiatic languages) where pluralization rules are much more complex. If this does not fit your requirement we recommend to reformulate your text, so that you do not need to use pluralization. Example: instead of saying 'You have added 2 baggages' you may want to say 'Pieces of baggage: 2' which should be fine for most of languages no matter which number is considered to be plural.
|
|
445
443
|
|
|
446
444
|
#### Integration with ngx-translate
|
|
@@ -504,7 +502,7 @@ Sometimes you may want to display a different resource based on some property va
|
|
|
504
502
|
```
|
|
505
503
|
|
|
506
504
|
```typescript
|
|
507
|
-
// in component html
|
|
505
|
+
// in component html
|
|
508
506
|
<ul>
|
|
509
507
|
<li>{{ translations.people | translate: { gender: 'female', how: 'influential' } }}</li>
|
|
510
508
|
<li>{{ translations.people | translate: { gender: 'male', how: 'funny' } }}</li>
|
|
@@ -517,22 +515,22 @@ Note again that *translations.people* matches *global.people* key
|
|
|
517
515
|
**Output**
|
|
518
516
|
|
|
519
517
|
```
|
|
520
|
-
- She is influential
|
|
521
|
-
- He is funny
|
|
522
|
-
- They are affectionate
|
|
518
|
+
- She is influential
|
|
519
|
+
- He is funny
|
|
520
|
+
- They are affectionate
|
|
523
521
|
```
|
|
524
522
|
|
|
525
523
|
## Debugging
|
|
526
524
|
|
|
527
525
|
### Runtime: toggle translation on and off
|
|
528
526
|
|
|
529
|
-
In order to be able to more easily identify which key corresponds to a given text, the ``LocalizationService`` exposes a function ``toggleShowKeys()`` that can be called in order to deactivate or reactivate the translation mechanism at **runtime**.
|
|
527
|
+
In order to be able to more easily identify which key corresponds to a given text, the ``LocalizationService`` exposes a function ``toggleShowKeys()`` that can be called in order to deactivate or reactivate the translation mechanism at **runtime**.
|
|
530
528
|
While deactivated, the ``translate`` **pipe** and **directive** will output the translation keys instead of their resolved values.
|
|
531
529
|
|
|
532
530
|
> **Important**: this mechanism only applies to the pipe and directive exported by Otter's ``LocalizationModule``. The original ones from ``ngx-translate`` do not support it.
|
|
533
531
|
|
|
534
|
-
First, this mechanism has to be activated via the ``LocalizationConfiguration`` that you can provide in your ``ApplicationModule``.
|
|
535
|
-
This is mainly for performances reason: the way it works is it adds a new subscription to every ``translate`` pipe and directive in order to know when translations are turned on or off.
|
|
532
|
+
First, this mechanism has to be activated via the ``LocalizationConfiguration`` that you can provide in your ``ApplicationModule``.
|
|
533
|
+
This is mainly for performances reason: the way it works is it adds a new subscription to every ``translate`` pipe and directive in order to know when translations are turned on or off.
|
|
536
534
|
Not enabling it allows to avoid all those subscriptions, and should be the baseline for a production environment.
|
|
537
535
|
|
|
538
536
|
Example:
|
package/annotations/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/annotations/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/annotations/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../../src/annotations/localization.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"localization.d.ts","sourceRoot":"","sources":["../../src/annotations/localization.ts"],"names":[],"mappings":"AAEA;;;GAGG;AAEH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,YACvB,GAAG,OAAO,MAAM,UAqBjC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { logging } from '@angular-devkit/core';
|
|
2
2
|
import type { JSONLocalization, LocalizationMetadata } from '@o3r/localization';
|
|
3
|
+
import type { LocalizationExtractorBuilderSchema } from '../localization-extractor/schema';
|
|
3
4
|
/** Map of Localization Metadata base on localization key */
|
|
4
5
|
export interface LocalizationMetadataAsMap {
|
|
5
6
|
[key: string]: JSONLocalization;
|
|
@@ -38,54 +39,42 @@ export interface LibraryMetadataMap {
|
|
|
38
39
|
* Localization extractor
|
|
39
40
|
*/
|
|
40
41
|
export declare class LocalizationExtractor {
|
|
42
|
+
private readonly options?;
|
|
41
43
|
/** TsConfig of the file to base on */
|
|
42
|
-
private tsconfigPath;
|
|
43
|
-
private logger;
|
|
44
|
-
constructor(tsconfigPath: string, logger: logging.LoggerApi);
|
|
44
|
+
private readonly tsconfigPath;
|
|
45
|
+
private readonly logger;
|
|
46
|
+
constructor(tsconfigPath: string, logger: logging.LoggerApi, options?: Partial<LocalizationExtractorBuilderSchema> | undefined);
|
|
45
47
|
/** Get the list of file from tsconfig.json */
|
|
46
48
|
private getFilesFromTsConfig;
|
|
47
49
|
/**
|
|
48
50
|
* Return the class node if the class is an angular element
|
|
49
|
-
*
|
|
50
51
|
* @param source Ts file source
|
|
51
52
|
*/
|
|
52
53
|
private getAngularClassNode;
|
|
53
|
-
/**
|
|
54
|
-
* Retrieve the localization json file from TS Code
|
|
55
|
-
*
|
|
56
|
-
* @param node TSNode of the angular component class
|
|
57
|
-
* @param source Ts file source
|
|
58
|
-
*/
|
|
59
|
-
private getLocalizationFileFromAngularElement;
|
|
60
54
|
/**
|
|
61
55
|
* Get the list of referenced translation files
|
|
62
|
-
*
|
|
63
56
|
* @param localizationFileContent JSON content of a location file
|
|
64
57
|
* @param localizationFilePath Path of the localization file
|
|
65
58
|
*/
|
|
66
59
|
private getReferencedFiles;
|
|
67
60
|
/**
|
|
68
61
|
* Read a localization file
|
|
69
|
-
*
|
|
70
62
|
* @param locFile Path to the localization file
|
|
71
63
|
*/
|
|
72
64
|
private readLocalizationFile;
|
|
73
65
|
/**
|
|
74
66
|
* Read a metadata file
|
|
75
|
-
*
|
|
76
67
|
* @param metadataFile Path to the metadata file
|
|
77
68
|
*/
|
|
78
69
|
private readMetadataFile;
|
|
79
70
|
/**
|
|
80
|
-
*
|
|
81
|
-
*
|
|
71
|
+
* Generate a metadata item from a localization item
|
|
82
72
|
* @param loc Localization item
|
|
83
73
|
* @param key Key of the localization
|
|
84
74
|
*/
|
|
85
75
|
private generateMetadataItemFromLocalization;
|
|
86
76
|
/**
|
|
87
77
|
* Compares two JSONLocalization object by their keys and returns the result of the string comparison
|
|
88
|
-
*
|
|
89
78
|
* @param a JSONLocalization
|
|
90
79
|
* @param b JSONLocalization
|
|
91
80
|
*/
|
|
@@ -98,7 +87,6 @@ export declare class LocalizationExtractor {
|
|
|
98
87
|
};
|
|
99
88
|
/**
|
|
100
89
|
* Generate the localization mapping for a list of files
|
|
101
|
-
*
|
|
102
90
|
* @param localizationFiles Localization files to load
|
|
103
91
|
* @param alreadyLoadedFiles List of localization files already loadded
|
|
104
92
|
* @param isDependency Determine if the list of files are dependencies of others
|
|
@@ -106,25 +94,21 @@ export declare class LocalizationExtractor {
|
|
|
106
94
|
getLocalizationMap(localizationFiles: string[], alreadyLoadedFiles?: string[], isDependency?: boolean): Promise<LocalizationFileMap>;
|
|
107
95
|
/**
|
|
108
96
|
* Extract the localization mapping from a tsconfig file
|
|
109
|
-
*
|
|
110
97
|
* @param extraLocalizationFiles Additional translations to add
|
|
111
98
|
*/
|
|
112
99
|
extractLocalizationFromTsConfig(extraLocalizationFiles?: string[]): Promise<LocalizationFileMap>;
|
|
113
100
|
/**
|
|
114
101
|
* Retrieve metadata from libraries
|
|
115
|
-
*
|
|
116
102
|
* @param libraries Libraries on which the project depend
|
|
117
103
|
*/
|
|
118
104
|
getMetadataFromLibraries(libraries: string[]): Promise<LibraryMetadataMap>;
|
|
119
105
|
/**
|
|
120
106
|
* Retrieve metadata from metadata files
|
|
121
|
-
*
|
|
122
107
|
* @param metadataFiles Metadata files
|
|
123
108
|
*/
|
|
124
109
|
getMetadataFromFiles(metadataFiles: string[]): Promise<LibraryMetadataMap>;
|
|
125
110
|
/**
|
|
126
111
|
* Generate metadata from localization and library metadata mappings
|
|
127
|
-
*
|
|
128
112
|
* @param localizationMap Map of localization files
|
|
129
113
|
* @param options Option of generation
|
|
130
114
|
* @param options.ignoreDuplicateKeys
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.generator.d.ts","sourceRoot":"","sources":["../../../builders/helpers/localization.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"localization.generator.d.ts","sourceRoot":"","sources":["../../../builders/helpers/localization.generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAMhF,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AAK3F,4DAA4D;AAC5D,MAAM,WAAW,yBAAyB;IACxC,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,CAAC;CACjC;AAED,6BAA6B;AAC7B,MAAM,WAAW,qBAAqB;IACpC,4BAA4B;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,kCAAkC;AAClC,MAAM,WAAW,oBAAoB;IACnC,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,CAAC;CACtC;AAED,gCAAgC;AAChC,MAAM,WAAW,mBAAmB;IAClC,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,IAAI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,OAAO,CAAC;QAC7B,eAAe,EAAE,kBAAkB,CAAC;QACpC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,OAAO,CAAC;KACnB,GAAG,oBAAoB;CA0DzB"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.LocalizationExtractor = void 0;
|
|
4
4
|
const extractors_1 = require("@o3r/extractors");
|
|
5
|
+
const schematics_1 = require("@o3r/schematics");
|
|
5
6
|
const fs = require("node:fs");
|
|
6
7
|
const glob = require("globby");
|
|
7
8
|
const path = require("node:path");
|
|
@@ -12,7 +13,8 @@ const ANGULAR_ANNOTATION = ['Component', 'Injectable', 'Pipe'];
|
|
|
12
13
|
* Localization extractor
|
|
13
14
|
*/
|
|
14
15
|
class LocalizationExtractor {
|
|
15
|
-
constructor(tsconfigPath, logger) {
|
|
16
|
+
constructor(tsconfigPath, logger, options) {
|
|
17
|
+
this.options = options;
|
|
16
18
|
this.tsconfigPath = tsconfigPath;
|
|
17
19
|
this.logger = logger;
|
|
18
20
|
}
|
|
@@ -23,7 +25,6 @@ class LocalizationExtractor {
|
|
|
23
25
|
}
|
|
24
26
|
/**
|
|
25
27
|
* Return the class node if the class is an angular element
|
|
26
|
-
*
|
|
27
28
|
* @param source Ts file source
|
|
28
29
|
*/
|
|
29
30
|
getAngularClassNode(source) {
|
|
@@ -50,35 +51,8 @@ class LocalizationExtractor {
|
|
|
50
51
|
});
|
|
51
52
|
return angularItems.length ? angularItems : undefined;
|
|
52
53
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Retrieve the localization json file from TS Code
|
|
55
|
-
*
|
|
56
|
-
* @param node TSNode of the angular component class
|
|
57
|
-
* @param source Ts file source
|
|
58
|
-
*/
|
|
59
|
-
getLocalizationFileFromAngularElement(node, source) {
|
|
60
|
-
const localizationPaths = [];
|
|
61
|
-
node.forEachChild((item) => {
|
|
62
|
-
if (!ts.isPropertyDeclaration(item)) {
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
item.forEachChild((decorator) => {
|
|
66
|
-
if (!ts.isDecorator(decorator)) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
const text = decorator.getText(source);
|
|
70
|
-
const result = /^@Localization *\( *['"](.*)['"] *\)/.exec(text);
|
|
71
|
-
if (!result || !result[1]) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
localizationPaths.push(result[1]);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
return localizationPaths.length ? localizationPaths : undefined;
|
|
78
|
-
}
|
|
79
54
|
/**
|
|
80
55
|
* Get the list of referenced translation files
|
|
81
|
-
*
|
|
82
56
|
* @param localizationFileContent JSON content of a location file
|
|
83
57
|
* @param localizationFilePath Path of the localization file
|
|
84
58
|
*/
|
|
@@ -96,20 +70,23 @@ class LocalizationExtractor {
|
|
|
96
70
|
})
|
|
97
71
|
.map(({ ref }) => {
|
|
98
72
|
if (!ref.startsWith('.')) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
73
|
+
if (this.options?.libraries?.length && this.options.libraries.every((lib) => !ref.startsWith(lib))) {
|
|
74
|
+
try {
|
|
75
|
+
return require.resolve(ref);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// Should be a local file
|
|
79
|
+
}
|
|
104
80
|
}
|
|
81
|
+
return undefined;
|
|
105
82
|
}
|
|
106
83
|
return folder ? path.resolve(folder, ref) : ref;
|
|
107
|
-
})
|
|
84
|
+
})
|
|
85
|
+
.filter((ref) => !!ref);
|
|
108
86
|
return referencedFiles.length ? referencedFiles : undefined;
|
|
109
87
|
}
|
|
110
88
|
/**
|
|
111
89
|
* Read a localization file
|
|
112
|
-
*
|
|
113
90
|
* @param locFile Path to the localization file
|
|
114
91
|
*/
|
|
115
92
|
readLocalizationFile(locFile) {
|
|
@@ -117,15 +94,13 @@ class LocalizationExtractor {
|
|
|
117
94
|
}
|
|
118
95
|
/**
|
|
119
96
|
* Read a metadata file
|
|
120
|
-
*
|
|
121
97
|
* @param metadataFile Path to the metadata file
|
|
122
98
|
*/
|
|
123
99
|
readMetadataFile(metadataFile) {
|
|
124
100
|
return new Promise((resolve, reject) => fs.readFile(metadataFile, 'utf8', (err, data) => err ? reject(err) : resolve(JSON.parse(data))));
|
|
125
101
|
}
|
|
126
102
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
103
|
+
* Generate a metadata item from a localization item
|
|
129
104
|
* @param loc Localization item
|
|
130
105
|
* @param key Key of the localization
|
|
131
106
|
*/
|
|
@@ -143,17 +118,22 @@ class LocalizationExtractor {
|
|
|
143
118
|
res.tags = loc.tags;
|
|
144
119
|
}
|
|
145
120
|
if (loc.$ref) {
|
|
146
|
-
|
|
121
|
+
const [refPath, refKey] = loc.$ref.split('#/', 2);
|
|
122
|
+
if (refPath.startsWith('.') || this.options?.libraries?.some((lib) => refPath.startsWith(lib))) {
|
|
123
|
+
res.ref = refKey;
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
res.ref = loc.$ref;
|
|
127
|
+
}
|
|
147
128
|
}
|
|
148
129
|
if (typeof loc.defaultValue === 'undefined' && typeof loc.$ref === 'undefined' && !loc.dictionary) {
|
|
149
130
|
this.logger.error(`${key} has no default value or $ref defined`);
|
|
150
|
-
throw new
|
|
131
|
+
throw new schematics_1.O3rCliError(`${key} has no default value or $ref defined`);
|
|
151
132
|
}
|
|
152
133
|
return res;
|
|
153
134
|
}
|
|
154
135
|
/**
|
|
155
136
|
* Compares two JSONLocalization object by their keys and returns the result of the string comparison
|
|
156
|
-
*
|
|
157
137
|
* @param a JSONLocalization
|
|
158
138
|
* @param b JSONLocalization
|
|
159
139
|
*/
|
|
@@ -172,8 +152,10 @@ class LocalizationExtractor {
|
|
|
172
152
|
getPatternsFromTsConfig() {
|
|
173
153
|
const tsconfigResult = ts.readConfigFile(this.tsconfigPath, ts.sys.readFile);
|
|
174
154
|
if (tsconfigResult.error) {
|
|
175
|
-
|
|
176
|
-
|
|
155
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
156
|
+
const stringError = tsconfigResult.error.messageText.toString();
|
|
157
|
+
this.logger.error(stringError);
|
|
158
|
+
throw new schematics_1.O3rCliError(stringError);
|
|
177
159
|
}
|
|
178
160
|
const include = [...(tsconfigResult.config.files || []), ...(tsconfigResult.config.include || [])];
|
|
179
161
|
const exclude = tsconfigResult.config.exclude || [];
|
|
@@ -182,7 +164,6 @@ class LocalizationExtractor {
|
|
|
182
164
|
}
|
|
183
165
|
/**
|
|
184
166
|
* Generate the localization mapping for a list of files
|
|
185
|
-
*
|
|
186
167
|
* @param localizationFiles Localization files to load
|
|
187
168
|
* @param alreadyLoadedFiles List of localization files already loadded
|
|
188
169
|
* @param isDependency Determine if the list of files are dependencies of others
|
|
@@ -212,7 +193,6 @@ class LocalizationExtractor {
|
|
|
212
193
|
}
|
|
213
194
|
/**
|
|
214
195
|
* Extract the localization mapping from a tsconfig file
|
|
215
|
-
*
|
|
216
196
|
* @param extraLocalizationFiles Additional translations to add
|
|
217
197
|
*/
|
|
218
198
|
async extractLocalizationFromTsConfig(extraLocalizationFiles = []) {
|
|
@@ -224,9 +204,9 @@ class LocalizationExtractor {
|
|
|
224
204
|
const localizationFiles = tsFiles
|
|
225
205
|
.map((file) => ({ file, source: program.getSourceFile(file) }))
|
|
226
206
|
.map(({ file, source }) => ({ file, classes: source && this.getAngularClassNode(source), source }))
|
|
227
|
-
.filter(({ classes
|
|
228
|
-
.map(({ file, classes
|
|
229
|
-
.map((classItem) =>
|
|
207
|
+
.filter(({ classes }) => !!classes)
|
|
208
|
+
.map(({ file, classes }) => classes
|
|
209
|
+
.map((classItem) => (0, extractors_1.getLocalizationFileFromAngularElement)(classItem))
|
|
230
210
|
.filter((locFiles) => !!locFiles)
|
|
231
211
|
.reduce((acc, locFiles) => {
|
|
232
212
|
acc.push(...locFiles.filter((f) => acc.indexOf(f) === -1));
|
|
@@ -242,7 +222,6 @@ class LocalizationExtractor {
|
|
|
242
222
|
}
|
|
243
223
|
/**
|
|
244
224
|
* Retrieve metadata from libraries
|
|
245
|
-
*
|
|
246
225
|
* @param libraries Libraries on which the project depend
|
|
247
226
|
*/
|
|
248
227
|
async getMetadataFromLibraries(libraries) {
|
|
@@ -253,7 +232,6 @@ class LocalizationExtractor {
|
|
|
253
232
|
}
|
|
254
233
|
/**
|
|
255
234
|
* Retrieve metadata from metadata files
|
|
256
|
-
*
|
|
257
235
|
* @param metadataFiles Metadata files
|
|
258
236
|
*/
|
|
259
237
|
async getMetadataFromFiles(metadataFiles) {
|
|
@@ -265,7 +243,6 @@ class LocalizationExtractor {
|
|
|
265
243
|
}
|
|
266
244
|
/**
|
|
267
245
|
* Generate metadata from localization and library metadata mappings
|
|
268
|
-
*
|
|
269
246
|
* @param localizationMap Map of localization files
|
|
270
247
|
* @param options Option of generation
|
|
271
248
|
* @param options.ignoreDuplicateKeys
|
|
@@ -275,24 +252,46 @@ class LocalizationExtractor {
|
|
|
275
252
|
*/
|
|
276
253
|
generateMetadata(localizationMap, options) {
|
|
277
254
|
const metadata = {};
|
|
278
|
-
|
|
255
|
+
let hasDuplicateKey = false;
|
|
256
|
+
const addMetadata = (data, origin, libraries = []) => {
|
|
279
257
|
if (metadata[data.key]) {
|
|
258
|
+
hasDuplicateKey = true;
|
|
280
259
|
if (options.ignoreDuplicateKeys) {
|
|
281
260
|
this.logger.warn(`The key ${data.key} from ${origin} will override the previous value (${metadata[data.key].value || 'ref ' + metadata[data.key].ref} -> ${data.value || 'ref ' + data.ref})`);
|
|
282
261
|
}
|
|
283
262
|
else {
|
|
284
263
|
this.logger.error(`The key ${data.key} from ${origin} try to override the previous value (${metadata[data.key].value || 'ref ' + metadata[data.key].ref} -> ${data.value || 'ref ' + data.ref})`);
|
|
285
|
-
throw new Error('Duplicate key');
|
|
286
264
|
}
|
|
287
265
|
}
|
|
288
|
-
metadata[data.key] = data
|
|
266
|
+
metadata[data.key] = data.ref && data.ref.includes('#/') && libraries.some((lib) => data.ref.startsWith(lib)) ? {
|
|
267
|
+
...data,
|
|
268
|
+
ref: data.ref.split('#/')[1]
|
|
269
|
+
} : data;
|
|
289
270
|
};
|
|
290
271
|
Object.keys(options.libraryMetadata)
|
|
291
|
-
.forEach((lib) => options.libraryMetadata[lib].forEach((dataLoc) => addMetadata(dataLoc, lib)));
|
|
272
|
+
.forEach((lib) => options.libraryMetadata[lib].forEach((dataLoc) => addMetadata(dataLoc, lib, this.options?.libraries)));
|
|
292
273
|
Object.keys(localizationMap)
|
|
293
274
|
.forEach((locFile) => Object.keys(localizationMap[locFile].data)
|
|
294
275
|
.forEach((locKey) => addMetadata(this.generateMetadataItemFromLocalization(localizationMap[locFile].data[locKey], locKey), locFile)));
|
|
295
|
-
|
|
276
|
+
if (hasDuplicateKey && !options.ignoreDuplicateKeys) {
|
|
277
|
+
throw new schematics_1.O3rCliError('Duplicate key');
|
|
278
|
+
}
|
|
279
|
+
const localizationMetadata = Object.values(metadata);
|
|
280
|
+
let hasUnknownRef = false;
|
|
281
|
+
localizationMetadata.forEach((data) => {
|
|
282
|
+
if (data.ref && !data.ref.includes('#/')) {
|
|
283
|
+
if (!metadata[data.ref]) {
|
|
284
|
+
hasUnknownRef = true;
|
|
285
|
+
this.logger.error(`The key ${data.ref} is unknown but referenced by ${data.key}.`);
|
|
286
|
+
}
|
|
287
|
+
else if (typeof data.description === 'undefined') {
|
|
288
|
+
data.description = metadata[data.ref].description;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
if (hasUnknownRef) {
|
|
293
|
+
throw new schematics_1.O3rCliError('Unknown referenced key');
|
|
294
|
+
}
|
|
296
295
|
return options.sortKeys ? localizationMetadata.sort((a, b) => this.compareKeys(a, b)) : localizationMetadata;
|
|
297
296
|
}
|
|
298
297
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localization.generator.js","sourceRoot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AAC;IAC/G,CAAC;CACF;AAxVD,sDAwVC"}
|
|
1
|
+
{"version":3,"file":"localization.generator.js","sourceRoot":"","sources":["../../../builders/helpers/localization.generator.ts"],"names":[],"mappings":";;;AACA,gDAA+F;AAE/F,gDAA8C;AAC9C,8BAA8B;AAC9B,+BAA+B;AAC/B,kCAAkC;AAClC,iCAAiC;AAGjC,4CAA4C;AAC5C,MAAM,kBAAkB,GAAG,CAAC,WAAW,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AAyC/D;;GAEG;AACH,MAAa,qBAAqB;IAOhC,YAAY,YAAoB,EAAE,MAAyB,EAAmB,OAAqD;QAArD,YAAO,GAAP,OAAO,CAA8C;QACjI,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,8CAA8C;IACtC,oBAAoB;QAC1B,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAC,CAAC,CAAC;IACpD,CAAC;IAED;;;OAGG;IACK,mBAAmB,CAAC,MAAqB;QAC/C,MAAM,YAAY,GAA0B,EAAE,CAAC;QAC/C,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;YAC3B,IAAI,CAAC,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE;gBAChC,OAAO;aACR;YAED,IAAI,aAAa,GAAG,KAAK,CAAC;YAC1B,IAAI,CAAC,YAAY,CAAC,CAAC,SAAS,EAAE,EAAE;gBAC9B,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC,EAAE;oBAC/C,OAAO;iBACR;gBACD,MAAM,IAAI,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACvC,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,IAAI,wBAAW,CAAC,eAAe,CAAC,CAAC;SACxC;QAED,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACrD,IAAI,aAAa,GAAG,KAAK,CAAC;QAE1B,oBAAoB,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACpC,IAAI,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBACxC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;oBACvB,aAAa,GAAG,IAAI,CAAC;oBACrB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,GAAG,iCAAiC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;iBACpF;qBAAM,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,WAAW,EAAE;oBAClD,IAAI,CAAC,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC;iBACnD;aACF;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,aAAa,EAAE;YACjB,MAAM,IAAI,wBAAW,CAAC,wBAAwB,CAAC,CAAC;SACjD;QAED,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,oBAAoB,CAAC;IAC/G,CAAC;CACF;AAjVD,sDAiVC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/localization/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/localization/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAgFrD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAAC,CAGvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,EAChB,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAC1C,sBAAsB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAC9C,cAAc,GAAE,GAAG,CAAC,MAAM,CAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA8BjE;;AAgLD,wBA0MG"}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getTranslationsForLanguage = exports.loadTranslations = void 0;
|
|
4
4
|
const architect_1 = require("@angular-devkit/architect");
|
|
5
|
+
const schematics_1 = require("@o3r/schematics");
|
|
5
6
|
const fs = require("node:fs");
|
|
6
7
|
const globby_1 = require("globby");
|
|
7
8
|
const path = require("node:path");
|
|
@@ -54,7 +55,7 @@ function checkUnusedTranslation(language, defaultBundle, customTranslations, con
|
|
|
54
55
|
.filter((key) => !dictionaryKeysPatterns.some((dictionaryKeyPattern) => key.startsWith(dictionaryKeyPattern)));
|
|
55
56
|
missingMetadata.forEach((key) => context.logger[failIfMissingMetadata ? 'error' : 'warn'](`The key "${key}" from "${language}" is not part of the MetaData`));
|
|
56
57
|
if (missingMetadata.length && failIfMissingMetadata) {
|
|
57
|
-
throw new
|
|
58
|
+
throw new schematics_1.O3rCliError(`There is missing metadata for ${language}`);
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
@@ -98,7 +99,7 @@ function getTranslationsForLanguage(language, filesPerLanguage, defaultLanguageM
|
|
|
98
99
|
if (defaultLanguage) {
|
|
99
100
|
// Throw an error if we find a circular dependency
|
|
100
101
|
if (dependencyPath.has(defaultLanguage)) {
|
|
101
|
-
throw new
|
|
102
|
+
throw new schematics_1.O3rCliError(`Circular dependency found: ${[...Array.from(dependencyPath), defaultLanguage].join('->')}`);
|
|
102
103
|
}
|
|
103
104
|
else {
|
|
104
105
|
// Else, recursively resolve its bundle and use it as a base for the current language
|
|
@@ -234,7 +235,7 @@ function startMetadataGenerator(localizationExtractorTarget, context) {
|
|
|
234
235
|
* @param context Ng Builder context
|
|
235
236
|
*/
|
|
236
237
|
async function checkMetadata(localizationMetaDataFile, localizationExtractorTarget, context) {
|
|
237
|
-
let metaDataExists =
|
|
238
|
+
let metaDataExists = fs.existsSync(localizationMetaDataFile);
|
|
238
239
|
if (!metaDataExists) {
|
|
239
240
|
context.logger.warn(`The file ${localizationMetaDataFile} does not exist, the extractor will be run`);
|
|
240
241
|
context.reportProgress(2, STEP_NUMBER, 'Generating Localization metadata file');
|
|
@@ -244,7 +245,7 @@ async function checkMetadata(localizationMetaDataFile, localizationExtractorTarg
|
|
|
244
245
|
return extractorBuildResult;
|
|
245
246
|
}
|
|
246
247
|
else {
|
|
247
|
-
metaDataExists =
|
|
248
|
+
metaDataExists = fs.existsSync(localizationMetaDataFile);
|
|
248
249
|
if (!metaDataExists) {
|
|
249
250
|
return {
|
|
250
251
|
success: false,
|