@o3r/localization 9.4.0-alpha.27 → 9.4.0-alpha.29
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.
|
@@ -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;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,EAAE,oBAAoB,CAAC;QAC3B,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED,4BAA4B;AAC5B,MAAM,WAAW,kBAAkB;IACjC,CAAC,mBAAmB,EAAE,MAAM,GAAG,oBAAoB,CAAC;CACrD;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAEhC,sCAAsC;IACtC,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,MAAM,CAAoB;gBAEtB,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,SAAS;IAK3D,8CAA8C;IAC9C,OAAO,CAAC,oBAAoB;IAK5B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IA4B3B;;;;;OAKG;IACH,OAAO,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;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,kC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;;;;;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"}
|
|
@@ -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
|
|
229
|
-
.map(({ file, classes
|
|
230
|
-
.map((classItem) =>
|
|
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));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/localization",
|
|
3
|
-
"version": "9.4.0-alpha.
|
|
3
|
+
"version": "9.4.0-alpha.29",
|
|
4
4
|
"description": "This module provides a runtime dynamic language/translation support and debug tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"localization",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"@formatjs/intl-numberformat": "^8.0.2",
|
|
21
21
|
"@ngrx/store": "~16.3.0",
|
|
22
22
|
"@ngx-translate/core": "~15.0.0",
|
|
23
|
-
"@o3r/core": "^9.4.0-alpha.
|
|
24
|
-
"@o3r/dynamic-content": "^9.4.0-alpha.
|
|
25
|
-
"@o3r/extractors": "^9.4.0-alpha.
|
|
26
|
-
"@o3r/logger": "^9.4.0-alpha.
|
|
27
|
-
"@o3r/schematics": "^9.4.0-alpha.
|
|
23
|
+
"@o3r/core": "^9.4.0-alpha.29",
|
|
24
|
+
"@o3r/dynamic-content": "^9.4.0-alpha.29",
|
|
25
|
+
"@o3r/extractors": "^9.4.0-alpha.29",
|
|
26
|
+
"@o3r/logger": "^9.4.0-alpha.29",
|
|
27
|
+
"@o3r/schematics": "^9.4.0-alpha.29",
|
|
28
28
|
"@schematics/angular": "~16.2.0",
|
|
29
29
|
"chokidar": "^3.5.2",
|
|
30
30
|
"intl-messageformat": "~10.5.0",
|