@ni/xliff-to-json-converter 1.1.12 → 1.1.14
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/dist/commonjs/convert.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.convertXliff2Json = convertXliff2Json;
|
|
4
|
+
exports.xliff2Json = xliff2Json;
|
|
5
|
+
exports.makeParsedTranslation = makeParsedTranslation;
|
|
4
6
|
const json_file_1 = require("./json-file");
|
|
5
7
|
const xliff_file_1 = require("./xliff-file");
|
|
6
8
|
async function convertXliff2Json(src, dst) {
|
|
@@ -8,7 +10,6 @@ async function convertXliff2Json(src, dst) {
|
|
|
8
10
|
const json = xliff2Json(xliff);
|
|
9
11
|
(0, json_file_1.saveJson)(json, dst);
|
|
10
12
|
}
|
|
11
|
-
exports.convertXliff2Json = convertXliff2Json;
|
|
12
13
|
function xliff2Json(xliff) {
|
|
13
14
|
const translations = {};
|
|
14
15
|
const template = xliff.resources['ng2.template'];
|
|
@@ -25,7 +26,6 @@ function xliff2Json(xliff) {
|
|
|
25
26
|
};
|
|
26
27
|
return json;
|
|
27
28
|
}
|
|
28
|
-
exports.xliff2Json = xliff2Json;
|
|
29
29
|
function xliffTranslation2jsonString(xliff) {
|
|
30
30
|
if (xliff === undefined) {
|
|
31
31
|
// translating the empty string (empty source is technically allowed, makes no sense)
|
|
@@ -76,4 +76,3 @@ function makeParsedTranslation(messageParts, placeholderNames) {
|
|
|
76
76
|
}
|
|
77
77
|
return messageString;
|
|
78
78
|
}
|
|
79
|
-
exports.makeParsedTranslation = makeParsedTranslation;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.stringify = stringify;
|
|
4
|
+
exports.saveJson = saveJson;
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
function stringify(json) {
|
|
6
7
|
const content = JSON.stringify(json, undefined, 4);
|
|
7
8
|
return content;
|
|
8
9
|
}
|
|
9
|
-
exports.stringify = stringify;
|
|
10
10
|
function saveJson(json, dst) {
|
|
11
11
|
const content = stringify(json);
|
|
12
12
|
(0, fs_1.writeFileSync)(dst, content);
|
|
13
13
|
}
|
|
14
|
-
exports.saveJson = saveJson;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.loadXliff = loadXliff;
|
|
4
|
+
exports.parseXliff = parseXliff;
|
|
4
5
|
const fs_1 = require("fs");
|
|
5
6
|
const xliff_1 = require("xliff");
|
|
6
7
|
async function loadXliff(path) {
|
|
7
8
|
const xliff = (0, fs_1.readFileSync)(path);
|
|
8
9
|
return await parseXliff(xliff.toString());
|
|
9
10
|
}
|
|
10
|
-
exports.loadXliff = loadXliff;
|
|
11
11
|
async function parseXliff(contents) {
|
|
12
12
|
return await (0, xliff_1.xliff12ToJs)(contents, { captureSpacesBetweenElements: true });
|
|
13
13
|
}
|
|
14
|
-
exports.parseXliff = parseXliff;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ni/xliff-to-json-converter",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.14",
|
|
4
4
|
"description": "Utility to convert translation files from XLIFF to JSON for Angular localization",
|
|
5
5
|
"main": "dist/commonjs/cli.js",
|
|
6
6
|
"bin": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@types/yargs": "^17.0.10",
|
|
33
33
|
"jasmine": "^5.1.0",
|
|
34
34
|
"jasmine-core": "^5.1.2",
|
|
35
|
-
"typescript": "~5.
|
|
35
|
+
"typescript": "~5.8.3"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"xliff": "^6.1.0",
|