@o3r/localization 11.2.0-prerelease.50 → 11.2.0-prerelease.52
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 +2 -2
- package/builders/i18n/index.js +1 -1
- package/builders/localization-extractor/index.js +1 -1
- package/package.json +6 -6
- package/schematics/localization-base/index.js +1 -1
- package/schematics/ng-add/helpers/devtools-registration.d.ts.map +1 -1
- package/schematics/ng-add/helpers/devtools-registration.js +2 -1
- package/schematics/ng-add/index.js +1 -1
|
@@ -90,7 +90,7 @@ class LocalizationExtractor {
|
|
|
90
90
|
* @param locFile Path to the localization file
|
|
91
91
|
*/
|
|
92
92
|
async readLocalizationFile(locFile) {
|
|
93
|
-
const content = JSON.parse(await fs.promises.readFile(locFile, { encoding: '
|
|
93
|
+
const content = JSON.parse(await fs.promises.readFile(locFile, { encoding: 'utf8' }));
|
|
94
94
|
if (content.$schema) {
|
|
95
95
|
delete content.$schema;
|
|
96
96
|
}
|
|
@@ -101,7 +101,7 @@ class LocalizationExtractor {
|
|
|
101
101
|
* @param metadataFile Path to the metadata file
|
|
102
102
|
*/
|
|
103
103
|
async readMetadataFile(metadataFile) {
|
|
104
|
-
return JSON.parse(await fs.promises.readFile(metadataFile, { encoding: '
|
|
104
|
+
return JSON.parse(await fs.promises.readFile(metadataFile, { encoding: 'utf8' }));
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
107
|
* Generate a metadata item from a localization item
|
package/builders/i18n/index.js
CHANGED
|
@@ -10,7 +10,7 @@ exports.default = (0, architect_1.createBuilder)((0, extractors_1.createBuilderW
|
|
|
10
10
|
options.localizationConfigs.forEach((config) => {
|
|
11
11
|
const fileNames = (0, globby_1.sync)(config.localizationFiles.map((files) => path.posix.join(posixWorkspaceRoot, files)));
|
|
12
12
|
fileNames.forEach((filePath) => {
|
|
13
|
-
const localizationJson = JSON.parse(fs.readFileSync(filePath, { encoding: '
|
|
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
|
.sort((a, b) => a[0] < b[0] ? -1 : 1)
|
|
@@ -65,7 +65,7 @@ exports.default = (0, architect_1.createBuilder)((0, extractors_1.createBuilderW
|
|
|
65
65
|
if (translationsWithIssue.length) {
|
|
66
66
|
throw new schematics_1.O3rCliError(`The following translations are invalid: ${translationsWithIssue.map((translation) => translation.key).join(', ')}`);
|
|
67
67
|
}
|
|
68
|
-
(0, extractors_1.validateJson)(metadata,
|
|
68
|
+
(0, extractors_1.validateJson)(metadata, JSON.parse(fs.readFileSync(path.resolve(__dirname, '../../schemas/localization.metadata.schema.json'), { encoding: 'utf8' })), 'The output of localization metadata is not valid regarding the json schema, please check the details below : \n', options.strictMode);
|
|
69
69
|
context.reportProgress(STEP_NUMBER, STEP_NUMBER, 'Generating metadata');
|
|
70
70
|
// Create output folder if does not exist
|
|
71
71
|
const localizationMetadataFolder = path.dirname(path.resolve(context.workspaceRoot, options.outputFile));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@o3r/localization",
|
|
3
|
-
"version": "11.2.0-prerelease.
|
|
3
|
+
"version": "11.2.0-prerelease.52",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"@formatjs/intl-numberformat": "^8.0.2",
|
|
45
45
|
"@ngrx/store": "~18.0.0",
|
|
46
46
|
"@ngx-translate/core": "~15.0.0",
|
|
47
|
-
"@o3r/core": "^11.2.0-prerelease.
|
|
48
|
-
"@o3r/dynamic-content": "^11.2.0-prerelease.
|
|
49
|
-
"@o3r/extractors": "^11.2.0-prerelease.
|
|
50
|
-
"@o3r/logger": "^11.2.0-prerelease.
|
|
51
|
-
"@o3r/schematics": "^11.2.0-prerelease.
|
|
47
|
+
"@o3r/core": "^11.2.0-prerelease.52",
|
|
48
|
+
"@o3r/dynamic-content": "^11.2.0-prerelease.52",
|
|
49
|
+
"@o3r/extractors": "^11.2.0-prerelease.52",
|
|
50
|
+
"@o3r/logger": "^11.2.0-prerelease.52",
|
|
51
|
+
"@o3r/schematics": "^11.2.0-prerelease.52",
|
|
52
52
|
"@schematics/angular": "~18.2.0",
|
|
53
53
|
"@yarnpkg/cli": "^4.3.1",
|
|
54
54
|
"@yarnpkg/core": "^4.1.1",
|
|
@@ -11,7 +11,7 @@ const path = require("node:path");
|
|
|
11
11
|
const fs = require("node:fs");
|
|
12
12
|
const ts = require("typescript");
|
|
13
13
|
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
14
|
-
const ownPackageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: '
|
|
14
|
+
const ownPackageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' }));
|
|
15
15
|
/**
|
|
16
16
|
* Add Otter localization support
|
|
17
17
|
* @param options @see RuleFactory.options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/devtools-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"devtools-registration.d.ts","sourceRoot":"","sources":["../../../../schematics/ng-add/helpers/devtools-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAQvD;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,YAAmB,qBAAqB,KAAG,OAAO,CAAC,IAAI,CAgBnF,CAAC"}
|
|
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.registerDevtools = void 0;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const path = require("node:path");
|
|
6
|
+
const node_fs_1 = require("node:fs");
|
|
6
7
|
const DEVTOOL_MODULE_NAME = 'LocalizationDevtoolsModule';
|
|
7
8
|
const MESSAGE_DEVTOOL_SERVICE_NAME = 'LocalizationDevtoolsMessageService';
|
|
8
9
|
const CONSOLE_DEVTOOL_SERVICE_NAME = 'LocalizationDevtoolsConsoleService';
|
|
9
|
-
const PACKAGE_NAME =
|
|
10
|
+
const PACKAGE_NAME = JSON.parse((0, node_fs_1.readFileSync)(path.resolve(__dirname, '..', '..', '..', 'package.json'), { encoding: 'utf8' })).name;
|
|
10
11
|
/**
|
|
11
12
|
* Register Devtools to the application
|
|
12
13
|
* @param tree
|
|
@@ -25,7 +25,7 @@ function ngAddFn(options) {
|
|
|
25
25
|
const { applyEsLintFix, getPackageInstallConfig, getProjectNewDependenciesTypes, getWorkspaceConfig, setupDependencies, getO3rPeerDeps, getExternalDependenciesVersionRange, registerPackageCollectionSchematics, setupSchematicsParamsForProject } = await Promise.resolve().then(() => require('@o3r/schematics'));
|
|
26
26
|
const { updateI18n, updateLocalization } = await Promise.resolve().then(() => require('../localization-base'));
|
|
27
27
|
const packageJsonPath = path.resolve(__dirname, '..', '..', 'package.json');
|
|
28
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: '
|
|
28
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, { encoding: 'utf8' }));
|
|
29
29
|
const depsInfo = getO3rPeerDeps(packageJsonPath);
|
|
30
30
|
context.logger.info(`The package ${depsInfo.packageName} comes with a debug mechanism`);
|
|
31
31
|
context.logger.info('Get information on https://github.com/AmadeusITGroup/otter/tree/main/docs/localization/LOCALIZATION.md#Debugging');
|