auto-translate-json-library 1.4.9 → 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.9",
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": {
@@ -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
@@ -22,6 +22,7 @@ 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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-translate-json-library",
3
- "version": "1.4.9",
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": {