auto-translate-json-library 1.4.8 → 1.5.0

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-translate-json-library",
3
- "version": "1.4.8",
3
+ "version": "1.5.0",
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 --apply",
22
- "lint-fix-all": "biome check --apply-unsafe ./src",
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.9.4",
56
+ "@biomejs/biome": "2.1.2",
57
57
  "@types/minimist": "1.2.5",
58
- "@types/node": "22.10.10",
58
+ "@types/node": "24.0.15",
59
59
  "@types/yargs": "17.0.33",
60
60
  "ts-node": "10.9.2",
61
- "typescript": "5.7.3"
61
+ "typescript": "5.8.3"
62
62
  },
63
63
  "dependencies": {
64
- "@aws-sdk/client-translate": "3.734.0",
65
- "@google-cloud/translate": "8.5.0",
66
- "axios": "1.7.9",
67
- "deepl-node": "1.16.0",
68
- "dotenv": "16.4.7",
69
- "form-data": "4.0.1",
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": "4.80.1",
71
+ "openai": "5.10.1",
72
72
  "picocolors": "1.1.1",
73
- "uuid": "11.0.5",
74
- "yargs": "17.7.2"
73
+ "uuid": "11.1.0",
74
+ "yargs": "18.0.0"
75
75
  }
76
76
  }
@@ -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);
@@ -79,7 +79,7 @@ class Files {
79
79
  return fileName.replace(".json", "");
80
80
  }
81
81
  getTargetLocales() {
82
- const locales = new Array();
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);
@@ -5,9 +5,15 @@ const lib_1 = require("./lib");
5
5
  Object.defineProperty(exports, "translate", { enumerable: true, get: function () { return lib_1.translate; } });
6
6
  const config = {};
7
7
  setDefaultConfiguration();
8
- setConfigurationFromEnvironment();
9
- setConfigurationFromCLI();
10
8
  console.log(config);
9
+ try {
10
+ setConfigurationFromEnvironment();
11
+ setConfigurationFromCLI();
12
+ }
13
+ catch (error) {
14
+ console.log(error);
15
+ console.log(config);
16
+ }
11
17
  function setConfigurationFromCLI() {
12
18
  const argv = require("yargs").argv;
13
19
  if (argv.mode === "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,18 +12,17 @@ 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");
23
23
  function translate(sourceFile, config) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
+ var _a;
25
26
  // set the delimiters for named arguments
26
27
  const startDelimiter = config.startDelimiter || "{";
27
28
  if (startDelimiter) {
@@ -54,7 +55,7 @@ function translate(sourceFile, config) {
54
55
  console.warn("You must provide a Google, AWS, Azure, deepL, openai parameters first in the extension settings.");
55
56
  return;
56
57
  }
57
- const fileMode = config.mode;
58
+ const fileMode = (_a = config.mode) !== null && _a !== void 0 ? _a : "file";
58
59
  const files = readFiles(sourceFile, fileMode);
59
60
  if (files === null) {
60
61
  return;
@@ -119,7 +120,7 @@ const readFiles = (filePath, mode) => {
119
120
  function recurseNode(source_1, original_1, keepTranslations_1, keepExtras_1, sourceLocale_1, locale_1, translateEngine_1) {
120
121
  return __awaiter(this, arguments, void 0, function* (source, original, keepTranslations, keepExtras, sourceLocale, locale, translateEngine, ignorePrefix = "", isArray = false) {
121
122
  var _a;
122
- // biome-ignore lint/suspicious/noExplicitAny: <explanation>
123
+ // biome-ignore lint/suspicious/noExplicitAny: array and object types are used for flexibility
123
124
  const destination = isArray ? [] : {};
124
125
  // defaults
125
126
  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: <explanation>
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.8",
3
+ "version": "1.5.0",
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 --apply",
22
- "lint-fix-all": "biome check --apply-unsafe ./src",
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.9.4",
56
+ "@biomejs/biome": "2.1.2",
57
57
  "@types/minimist": "1.2.5",
58
- "@types/node": "22.10.10",
58
+ "@types/node": "24.0.15",
59
59
  "@types/yargs": "17.0.33",
60
60
  "ts-node": "10.9.2",
61
- "typescript": "5.7.3"
61
+ "typescript": "5.8.3"
62
62
  },
63
63
  "dependencies": {
64
- "@aws-sdk/client-translate": "3.734.0",
65
- "@google-cloud/translate": "8.5.0",
66
- "axios": "1.7.9",
67
- "deepl-node": "1.16.0",
68
- "dotenv": "16.4.7",
69
- "form-data": "4.0.1",
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": "4.80.1",
71
+ "openai": "5.10.1",
72
72
  "picocolors": "1.1.1",
73
- "uuid": "11.0.5",
74
- "yargs": "17.7.2"
73
+ "uuid": "11.1.0",
74
+ "yargs": "18.0.0"
75
75
  }
76
76
  }