@o3r/localization 9.4.0-alpha.3 → 9.4.0-alpha.30

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 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/.attachments/otter.png" alt="Super cute Otter!" width="40%"/>
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).
@@ -50,13 +50,6 @@ export declare class LocalizationExtractor {
50
50
  * @param source Ts file source
51
51
  */
52
52
  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
53
  /**
61
54
  * Get the list of referenced translation files
62
55
  *
@@ -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;AAUhF,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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O,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA8BjH;;;;OAIG;IACU,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE;IAQzD;;;;OAIG;IACU,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE;IASzD;;;;;;;;;OASG;IACI,gBAAgB,CAAC,eAAe,EAAE,mBAAmB,EAAE,OAAO,EAAE;QACrE,mBAAmB,EAAE,OAAO,CAAC;QAC7B,eAAe,EAAE,kBAAkB,CAAC;QACpC,UAAU,EAAE,MAAM,CAAC;QACnB,QAAQ,EAAE,OAAO,CAAC;KACnB,GAAG,oBAAoB;CAkCzB"}
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;AAUhF,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,IA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AAQ,EAAE,OAAO,CAAC;KACnB,GAAG,oBAAoB;CAkCzB"}
@@ -51,32 +51,6 @@ class LocalizationExtractor {
51
51
  });
52
52
  return angularItems.length ? angularItems : undefined;
53
53
  }
54
- /**
55
- * Retrieve the localization json file from TS Code
56
- *
57
- * @param node TSNode of the angular component class
58
- * @param source Ts file source
59
- */
60
- getLocalizationFileFromAngularElement(node, source) {
61
- const localizationPaths = [];
62
- node.forEachChild((item) => {
63
- if (!ts.isPropertyDeclaration(item)) {
64
- return;
65
- }
66
- item.forEachChild((decorator) => {
67
- if (!ts.isDecorator(decorator)) {
68
- return;
69
- }
70
- const text = decorator.getText(source);
71
- const result = /^@Localization *\( *['"](.*)['"] *\)/.exec(text);
72
- if (!result || !result[1]) {
73
- return;
74
- }
75
- localizationPaths.push(result[1]);
76
- });
77
- });
78
- return localizationPaths.length ? localizationPaths : undefined;
79
- }
80
54
  /**
81
55
  * Get the list of referenced translation files
82
56
  *
@@ -225,9 +199,9 @@ class LocalizationExtractor {
225
199
  const localizationFiles = tsFiles
226
200
  .map((file) => ({ file, source: program.getSourceFile(file) }))
227
201
  .map(({ file, source }) => ({ file, classes: source && this.getAngularClassNode(source), source }))
228
- .filter(({ classes, source }) => !!classes && !!source)
229
- .map(({ file, classes, source }) => classes
230
- .map((classItem) => this.getLocalizationFileFromAngularElement(classItem, source))
202
+ .filter(({ classes }) => !!classes)
203
+ .map(({ file, classes }) => classes
204
+ .map((classItem) => (0, extractors_1.getLocalizationFileFromAngularElement)(classItem))
231
205
  .filter((locFiles) => !!locFiles)
232
206
  .reduce((acc, locFiles) => {
233
207
  acc.push(...locFiles.filter((f) => acc.indexOf(f) === -1));
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/localization-extractor/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAI9D,cAAc,UAAU,CAAC;;AAEzB,wBA4LG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../builders/localization-extractor/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,kCAAkC,EAAE,MAAM,UAAU,CAAC;AAG9D,cAAc,UAAU,CAAC;;AAEzB,wBA2LG"}
@@ -95,7 +95,6 @@ exports.default = (0, architect_1.createBuilder)(async (options, context) => {
95
95
  };
96
96
  /**
97
97
  * Run a translation generation and report the result
98
- *
99
98
  * @param execution Execution process
100
99
  */
101
100
  const generateWithReport = async (execution) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o3r/localization",
3
- "version": "9.4.0-alpha.3",
3
+ "version": "9.4.0-alpha.30",
4
4
  "description": "This module provides a runtime dynamic language/translation support and debug tools.",
5
5
  "keywords": [
6
6
  "localization",
@@ -18,13 +18,13 @@
18
18
  "@angular/core": "~16.2.0",
19
19
  "@angular/platform-browser-dynamic": "~16.2.0",
20
20
  "@formatjs/intl-numberformat": "^8.0.2",
21
- "@ngrx/store": "~16.2.0",
21
+ "@ngrx/store": "~16.3.0",
22
22
  "@ngx-translate/core": "~15.0.0",
23
- "@o3r/core": "^9.4.0-alpha.3",
24
- "@o3r/dynamic-content": "^9.4.0-alpha.3",
25
- "@o3r/extractors": "^9.4.0-alpha.3",
26
- "@o3r/logger": "^9.4.0-alpha.3",
27
- "@o3r/schematics": "^9.4.0-alpha.3",
23
+ "@o3r/core": "^9.4.0-alpha.30",
24
+ "@o3r/dynamic-content": "^9.4.0-alpha.30",
25
+ "@o3r/extractors": "^9.4.0-alpha.30",
26
+ "@o3r/logger": "^9.4.0-alpha.30",
27
+ "@o3r/schematics": "^9.4.0-alpha.30",
28
28
  "@schematics/angular": "~16.2.0",
29
29
  "chokidar": "^3.5.2",
30
30
  "intl-messageformat": "~10.5.0",