auto-translate-json-library 1.4.7 → 1.4.9
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 +10 -0
- package/build/package.json +15 -15
- package/build/src/deepl.js +3 -1
- package/build/src/files.js +1 -1
- package/build/src/lib.js +5 -5
- package/build/src/util.js +1 -1
- package/package.json +15 -15
package/README.MD
CHANGED
|
@@ -141,6 +141,16 @@ default value 0
|
|
|
141
141
|
ATJ_OPEN_AI_PRESENCE_PENALTY
|
|
142
142
|
default value 0
|
|
143
143
|
|
|
144
|
+
Deepseek parameters
|
|
145
|
+
similar to OpenAI but you need to
|
|
146
|
+
put your deepseek secret key
|
|
147
|
+
ATJ_OPEN_AI_SECRET_KEY=sk-xxxxxx
|
|
148
|
+
and model
|
|
149
|
+
ATJ_OPEN_AI_MODEL=deepseek-chat
|
|
150
|
+
ATJ_OPEN_AI_BASE_URL=https://api.deepseek.com/v1
|
|
151
|
+
ATJ_OPEN_AI_TEMPERATURE=1.3
|
|
152
|
+
|
|
153
|
+
|
|
144
154
|
If you want to run it locally without using Open AI but compatible API
|
|
145
155
|
you need to modify base URL and model for example
|
|
146
156
|
if you use jan https://jan.ai/ you can modify base url model and maximum number of tokens (you do not pay for tokens anymore), secret key is not important
|
package/build/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-translate-json-library",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "Automatically translates JSON language files to other languages using Google Translate,AWS,Azure,DeepL,OpenAI or local OpenAI compatible server",
|
|
5
5
|
"main": "./build/src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"build:run": "ts-node ./build/src/index.js --pivotTranslation=./tests/translations/en.json",
|
|
19
19
|
"debug": "ts-node src/index.ts --pivotTranslation=./tests/translations/en.json",
|
|
20
20
|
"lint": "biome check ./src",
|
|
21
|
-
"lint-fix": "biome check ./src --
|
|
22
|
-
"lint-fix-all": "biome check --
|
|
21
|
+
"lint-fix": "biome check ./src --write",
|
|
22
|
+
"lint-fix-all": "biome check --write --unsafe ./src",
|
|
23
23
|
"format": "biome format ./src",
|
|
24
24
|
"format-fix": "biome format ./src --write",
|
|
25
25
|
"start": "ts-node src/index.ts"
|
|
@@ -53,24 +53,24 @@
|
|
|
53
53
|
],
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@biomejs/biome": "1.
|
|
56
|
+
"@biomejs/biome": "2.1.2",
|
|
57
57
|
"@types/minimist": "1.2.5",
|
|
58
|
-
"@types/node": "
|
|
58
|
+
"@types/node": "24.0.15",
|
|
59
59
|
"@types/yargs": "17.0.33",
|
|
60
60
|
"ts-node": "10.9.2",
|
|
61
|
-
"typescript": "5.
|
|
61
|
+
"typescript": "5.8.3"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aws-sdk/client-translate": "3.
|
|
65
|
-
"@google-cloud/translate": "
|
|
66
|
-
"axios": "1.
|
|
67
|
-
"deepl-node": "1.
|
|
68
|
-
"dotenv": "
|
|
69
|
-
"form-data": "4.0.
|
|
64
|
+
"@aws-sdk/client-translate": "3.848.0",
|
|
65
|
+
"@google-cloud/translate": "9.2.0",
|
|
66
|
+
"axios": "1.10.0",
|
|
67
|
+
"deepl-node": "1.19.0",
|
|
68
|
+
"dotenv": "17.2.0",
|
|
69
|
+
"form-data": "4.0.4",
|
|
70
70
|
"minimist": "1.2.8",
|
|
71
|
-
"openai": "
|
|
71
|
+
"openai": "5.10.1",
|
|
72
72
|
"picocolors": "1.1.1",
|
|
73
|
-
"uuid": "11.0
|
|
74
|
-
"yargs": "
|
|
73
|
+
"uuid": "11.1.0",
|
|
74
|
+
"yargs": "18.0.0"
|
|
75
75
|
}
|
|
76
76
|
}
|
package/build/src/deepl.js
CHANGED
|
@@ -99,7 +99,9 @@ class DeepLTranslate {
|
|
|
99
99
|
let args;
|
|
100
100
|
({ args, text } = util_1.Util.replaceContextVariables(text));
|
|
101
101
|
let result = "";
|
|
102
|
-
const translator = new deepl.Translator(this.subscriptionKey
|
|
102
|
+
const translator = new deepl.Translator(this.subscriptionKey, {
|
|
103
|
+
serverUrl: this.endpoint,
|
|
104
|
+
});
|
|
103
105
|
const translation = yield translator.translateText(text, sourceLocale, targetLocale);
|
|
104
106
|
result = translation.text;
|
|
105
107
|
result = util_1.Util.replaceArgumentsWithNumbers(args, result);
|
package/build/src/files.js
CHANGED
|
@@ -79,7 +79,7 @@ class Files {
|
|
|
79
79
|
return fileName.replace(".json", "");
|
|
80
80
|
}
|
|
81
81
|
getTargetLocales() {
|
|
82
|
-
const locales =
|
|
82
|
+
const locales = [];
|
|
83
83
|
const files = fs.readdirSync(this.folderPath);
|
|
84
84
|
for (const file of files) {
|
|
85
85
|
const locale = this.getLocaleFromFilename(file);
|
package/build/src/lib.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// The module 'vscode' contains the VS Code extensibility API
|
|
3
|
+
// Import the module and reference it with the alias vscode in your code below
|
|
2
4
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
5
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
6
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,13 +12,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
12
|
};
|
|
11
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
14
|
exports.translate = translate;
|
|
13
|
-
// The module 'vscode' contains the VS Code extensibility API
|
|
14
|
-
// Import the module and reference it with the alias vscode in your code below
|
|
15
|
-
const files_1 = require("./files");
|
|
16
|
-
const folderFiles_1 = require("./folderFiles");
|
|
17
15
|
const aws_1 = require("./aws");
|
|
18
16
|
const azure_1 = require("./azure");
|
|
19
17
|
const deepl_1 = require("./deepl");
|
|
18
|
+
const files_1 = require("./files");
|
|
19
|
+
const folderFiles_1 = require("./folderFiles");
|
|
20
20
|
const google_1 = require("./google");
|
|
21
21
|
const openai_1 = require("./openai");
|
|
22
22
|
const util_1 = require("./util");
|
|
@@ -119,7 +119,7 @@ const readFiles = (filePath, mode) => {
|
|
|
119
119
|
function recurseNode(source_1, original_1, keepTranslations_1, keepExtras_1, sourceLocale_1, locale_1, translateEngine_1) {
|
|
120
120
|
return __awaiter(this, arguments, void 0, function* (source, original, keepTranslations, keepExtras, sourceLocale, locale, translateEngine, ignorePrefix = "", isArray = false) {
|
|
121
121
|
var _a;
|
|
122
|
-
// biome-ignore lint/suspicious/noExplicitAny:
|
|
122
|
+
// biome-ignore lint/suspicious/noExplicitAny: array and object types are used for flexibility
|
|
123
123
|
const destination = isArray ? [] : {};
|
|
124
124
|
// defaults
|
|
125
125
|
if (keepTranslations === null) {
|
package/build/src/util.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Util = void 0;
|
|
4
|
-
// biome-ignore lint/complexity/noStaticOnlyClass:
|
|
4
|
+
// biome-ignore lint/complexity/noStaticOnlyClass: This class is used for utility functions that do not require instantiation
|
|
5
5
|
class Util {
|
|
6
6
|
static set startDelimiter(value) {
|
|
7
7
|
Util._startDelimiter = value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-translate-json-library",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "Automatically translates JSON language files to other languages using Google Translate,AWS,Azure,DeepL,OpenAI or local OpenAI compatible server",
|
|
5
5
|
"main": "./build/src/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"build:run": "ts-node ./build/src/index.js --pivotTranslation=./tests/translations/en.json",
|
|
19
19
|
"debug": "ts-node src/index.ts --pivotTranslation=./tests/translations/en.json",
|
|
20
20
|
"lint": "biome check ./src",
|
|
21
|
-
"lint-fix": "biome check ./src --
|
|
22
|
-
"lint-fix-all": "biome check --
|
|
21
|
+
"lint-fix": "biome check ./src --write",
|
|
22
|
+
"lint-fix-all": "biome check --write --unsafe ./src",
|
|
23
23
|
"format": "biome format ./src",
|
|
24
24
|
"format-fix": "biome format ./src --write",
|
|
25
25
|
"start": "ts-node src/index.ts"
|
|
@@ -53,24 +53,24 @@
|
|
|
53
53
|
],
|
|
54
54
|
"license": "MIT",
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@biomejs/biome": "1.
|
|
56
|
+
"@biomejs/biome": "2.1.2",
|
|
57
57
|
"@types/minimist": "1.2.5",
|
|
58
|
-
"@types/node": "
|
|
58
|
+
"@types/node": "24.0.15",
|
|
59
59
|
"@types/yargs": "17.0.33",
|
|
60
60
|
"ts-node": "10.9.2",
|
|
61
|
-
"typescript": "5.
|
|
61
|
+
"typescript": "5.8.3"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aws-sdk/client-translate": "3.
|
|
65
|
-
"@google-cloud/translate": "
|
|
66
|
-
"axios": "1.
|
|
67
|
-
"deepl-node": "1.
|
|
68
|
-
"dotenv": "
|
|
69
|
-
"form-data": "4.0.
|
|
64
|
+
"@aws-sdk/client-translate": "3.848.0",
|
|
65
|
+
"@google-cloud/translate": "9.2.0",
|
|
66
|
+
"axios": "1.10.0",
|
|
67
|
+
"deepl-node": "1.19.0",
|
|
68
|
+
"dotenv": "17.2.0",
|
|
69
|
+
"form-data": "4.0.4",
|
|
70
70
|
"minimist": "1.2.8",
|
|
71
|
-
"openai": "
|
|
71
|
+
"openai": "5.10.1",
|
|
72
72
|
"picocolors": "1.1.1",
|
|
73
|
-
"uuid": "11.0
|
|
74
|
-
"yargs": "
|
|
73
|
+
"uuid": "11.1.0",
|
|
74
|
+
"yargs": "18.0.0"
|
|
75
75
|
}
|
|
76
76
|
}
|