@o3r/localization 14.0.0-next.5 → 14.0.0-next.7
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/builders/helpers/localization-generator.js +1 -1
- package/builders/i18n/index.js +1 -1
- package/builders/localization/index.js +1 -1
- package/package.json +7 -7
- package/schematics/cms-adapter/index.d.ts +1 -1
- package/schematics/cms-adapter/index.js +2 -2
- package/schematics/localization-base/index.d.ts +2 -2
- package/schematics/localization-base/index.js +2 -2
- package/schematics/localization-to-component/index.js +1 -1
|
@@ -294,7 +294,7 @@ class LocalizationExtractor {
|
|
|
294
294
|
if (hasUnknownRef) {
|
|
295
295
|
throw new schematics_1.O3rCliError('Unknown referenced key');
|
|
296
296
|
}
|
|
297
|
-
return options.sortKeys ? localizationMetadata.
|
|
297
|
+
return options.sortKeys ? localizationMetadata.toSorted((a, b) => this.compareKeys(a, b)) : localizationMetadata;
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
exports.LocalizationExtractor = LocalizationExtractor;
|
package/builders/i18n/index.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.default = (0, architect_1.createBuilder)((0, extractors_1.createBuilderW
|
|
|
13
13
|
const localizationJson = JSON.parse(fs.readFileSync(filePath, { encoding: 'utf8' }));
|
|
14
14
|
const newContent = JSON.stringify(Object.entries(localizationJson)
|
|
15
15
|
.filter(([, value]) => !value.dictionary && !value.$ref && value.defaultValue !== undefined)
|
|
16
|
-
.
|
|
16
|
+
.toSorted((a, b) => a[0] < b[0] ? -1 : 1)
|
|
17
17
|
.reduce((acc, [key, { defaultValue }]) => {
|
|
18
18
|
acc[key] = defaultValue;
|
|
19
19
|
return acc;
|
|
@@ -312,7 +312,7 @@ exports.default = (0, architect_1.createBuilder)((0, extractors_1.createBuilderW
|
|
|
312
312
|
Object.entries(bundles).forEach(([language, bundle]) => {
|
|
313
313
|
const filePath = path.resolve(writingFolder, `${language}.json`);
|
|
314
314
|
context.logger.info(`Writing file to disk ${filePath}`);
|
|
315
|
-
fs.writeFileSync(filePath, JSON.stringify(bundle, Object.keys(bundle).
|
|
315
|
+
fs.writeFileSync(filePath, JSON.stringify(bundle, Object.keys(bundle).toSorted(), 2));
|
|
316
316
|
});
|
|
317
317
|
return {
|
|
318
318
|
success: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/localization",
|
|
3
|
-
"version": "14.0.0-next.
|
|
3
|
+
"version": "14.0.0-next.7",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"@formatjs/intl-numberformat": "^8.0.2",
|
|
44
44
|
"@ngrx/store": "^20.0.0",
|
|
45
45
|
"@ngx-translate/core": "^15.0.0 || ~16.0.4",
|
|
46
|
-
"@o3r/core": "~14.0.0-next.
|
|
47
|
-
"@o3r/dynamic-content": "~14.0.0-next.
|
|
48
|
-
"@o3r/extractors": "~14.0.0-next.
|
|
49
|
-
"@o3r/logger": "~14.0.0-next.
|
|
50
|
-
"@o3r/schematics": "~14.0.0-next.
|
|
46
|
+
"@o3r/core": "~14.0.0-next.7",
|
|
47
|
+
"@o3r/dynamic-content": "~14.0.0-next.7",
|
|
48
|
+
"@o3r/extractors": "~14.0.0-next.7",
|
|
49
|
+
"@o3r/logger": "~14.0.0-next.7",
|
|
50
|
+
"@o3r/schematics": "~14.0.0-next.7",
|
|
51
51
|
"@schematics/angular": "^20.0.0",
|
|
52
52
|
"@yarnpkg/cli": "^4.3.1",
|
|
53
53
|
"@yarnpkg/core": "^4.1.1",
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
115
|
"dependencies": {
|
|
116
|
-
"@o3r/schematics": "~14.0.0-next.
|
|
116
|
+
"@o3r/schematics": "~14.0.0-next.7",
|
|
117
117
|
"tslib": "^2.6.2"
|
|
118
118
|
},
|
|
119
119
|
"engines": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
2
|
/**
|
|
3
3
|
* Update CMS adapter tools
|
|
4
|
-
* @param options @
|
|
4
|
+
* @param options {@link RuleFactory.options}
|
|
5
5
|
* @param options.projectName
|
|
6
6
|
*/
|
|
7
7
|
export declare const updateCmsAdapter: (options: any) => Rule;
|
|
@@ -6,7 +6,7 @@ const schematics_1 = require("@angular-devkit/schematics");
|
|
|
6
6
|
const schematics_2 = require("@o3r/schematics");
|
|
7
7
|
/**
|
|
8
8
|
* Update CMS adapter tools
|
|
9
|
-
* @param options @
|
|
9
|
+
* @param options {@link RuleFactory.options}
|
|
10
10
|
* @param options.projectName
|
|
11
11
|
*/
|
|
12
12
|
function updateCmsAdapterFn(options) {
|
|
@@ -74,7 +74,7 @@ function updateCmsAdapterFn(options) {
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Update CMS adapter tools
|
|
77
|
-
* @param options @
|
|
77
|
+
* @param options {@link RuleFactory.options}
|
|
78
78
|
* @param options.projectName
|
|
79
79
|
*/
|
|
80
80
|
exports.updateCmsAdapter = (0, schematics_2.createOtterSchematic)(updateCmsAdapterFn);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Rule } from '@angular-devkit/schematics';
|
|
2
2
|
/**
|
|
3
3
|
* Add Otter localization support
|
|
4
|
-
* @param options @
|
|
4
|
+
* @param options {@link RuleFactory.options}
|
|
5
5
|
* @param options.projectName
|
|
6
|
-
* @param rootPath @
|
|
6
|
+
* @param rootPath {@link RuleFactory.rootPath}
|
|
7
7
|
*/
|
|
8
8
|
export declare function updateLocalization(options: {
|
|
9
9
|
projectName?: string | null | undefined;
|
|
@@ -11,9 +11,9 @@ const change_1 = require("@schematics/angular/utility/change");
|
|
|
11
11
|
const ts = require("typescript");
|
|
12
12
|
/**
|
|
13
13
|
* Add Otter localization support
|
|
14
|
-
* @param options @
|
|
14
|
+
* @param options {@link RuleFactory.options}
|
|
15
15
|
* @param options.projectName
|
|
16
|
-
* @param rootPath @
|
|
16
|
+
* @param rootPath {@link RuleFactory.rootPath}
|
|
17
17
|
*/
|
|
18
18
|
function updateLocalization(options, rootPath) {
|
|
19
19
|
const mainAssetsFolder = 'src/assets';
|
|
@@ -101,7 +101,7 @@ function ngAddLocalizationFn(options) {
|
|
|
101
101
|
const newMembers = node.members
|
|
102
102
|
.filter((classElement) => !ts.isConstructorDeclaration(classElement))
|
|
103
103
|
.concat(propertiesToAdd, newContructorDeclaration)
|
|
104
|
-
.
|
|
104
|
+
.toSorted(schematics_2.sortClassElement);
|
|
105
105
|
(0, schematics_2.addCommentsOnClassProperties)(newMembers, {
|
|
106
106
|
translations: 'Localization of the component'
|
|
107
107
|
});
|