auto-translate-json-library 1.3.6 → 1.3.7
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/package.json +69 -69
- package/{build/src → src}/bin/cli.js +9 -0
- package/{build/src → src}/config.d.ts +8 -0
- package/{build/src → src}/index.js +9 -0
- package/{build/src → src}/lib.js +1 -1
- package/src/openai.d.ts +14 -0
- package/{build/src → src}/openai.js +26 -9
- package/README.MD +0 -150
- package/build/package.json +0 -71
- package/build/src/openai.d.ts +0 -7
- /package/{build/src → src}/aws.d.ts +0 -0
- /package/{build/src → src}/aws.js +0 -0
- /package/{build/src → src}/azure.d.ts +0 -0
- /package/{build/src → src}/azure.js +0 -0
- /package/{build/src → src}/bin/cli.d.ts +0 -0
- /package/{build/src → src}/config.js +0 -0
- /package/{build/src → src}/deepl.d.ts +0 -0
- /package/{build/src → src}/deepl.js +0 -0
- /package/{build/src → src}/files.d.ts +0 -0
- /package/{build/src → src}/files.js +0 -0
- /package/{build/src → src}/folderFiles.d.ts +0 -0
- /package/{build/src → src}/folderFiles.js +0 -0
- /package/{build/src → src}/google.d.ts +0 -0
- /package/{build/src → src}/google.js +0 -0
- /package/{build/src → src}/index.d.ts +0 -0
- /package/{build/src → src}/lib.d.ts +0 -0
- /package/{build/src → src}/translate.interface.d.ts +0 -0
- /package/{build/src → src}/translate.interface.js +0 -0
- /package/{build/src → src}/util.d.ts +0 -0
- /package/{build/src → src}/util.js +0 -0
package/package.json
CHANGED
|
@@ -1,71 +1,71 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
2
|
+
"name": "auto-translate-json-library",
|
|
3
|
+
"version": "1.3.7",
|
|
4
|
+
"description": "Automatically translates JSON language files to other languages using Google Translate,AWS,Azure,DeepL,OpenAI or local OpenAI compatible server",
|
|
5
|
+
"main": "./build/src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"auto-translate-json-library": "./build/src/bin/cli.js",
|
|
8
|
+
"atj": "./build/src/bin/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"types": "./build/src/index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"prepare": "tsc",
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"build:run": "ts-node ./build/src/index.js --pivotTranslation=./tests/translations/en.json",
|
|
15
|
+
"debug": "ts-node src/index.ts --pivotTranslation=./tests/translations/en.json",
|
|
16
|
+
"lint": "biome check ./src",
|
|
17
|
+
"lint-fix": "biome check ./src --apply",
|
|
18
|
+
"lint-fix-all": "biome check --apply-unsafe ./src",
|
|
19
|
+
"format": "biome format ./src",
|
|
20
|
+
"format-fix": "biome format ./src --write",
|
|
21
|
+
"start": "ts-node src/index.ts"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"translate",
|
|
25
|
+
"language",
|
|
26
|
+
"json",
|
|
27
|
+
"flutter",
|
|
28
|
+
"angular",
|
|
29
|
+
"ngx-translate",
|
|
30
|
+
"transloco",
|
|
31
|
+
"auto-translate-json",
|
|
32
|
+
"google",
|
|
33
|
+
"Azure",
|
|
34
|
+
"DeepL",
|
|
35
|
+
"OpenAI"
|
|
36
|
+
],
|
|
37
|
+
"author": "codegrue",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "https://github.com/topce/auto-translate-json-library"
|
|
41
|
+
},
|
|
42
|
+
"contributors": [
|
|
43
|
+
"codegrue",
|
|
44
|
+
"gajo357",
|
|
45
|
+
"topce",
|
|
46
|
+
"BenGMiles",
|
|
47
|
+
"stonega",
|
|
48
|
+
"alexei-petru"
|
|
49
|
+
],
|
|
50
|
+
"license": "MIT",
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@biomejs/biome": "1.5.3",
|
|
53
|
+
"@topce/typescript": "5.3.1",
|
|
54
|
+
"@types/minimist": "1.2.5",
|
|
55
|
+
"@types/node": "20.11.24",
|
|
56
|
+
"@types/yargs": "17.0.32",
|
|
57
|
+
"ts-node": "10.9.2"
|
|
58
|
+
},
|
|
59
|
+
"dependencies": {
|
|
60
|
+
"@aws-sdk/client-translate": "3.525.0",
|
|
61
|
+
"@google-cloud/translate": "8.1.0",
|
|
62
|
+
"axios": "1.6.7",
|
|
63
|
+
"dotenv": "16.4.5",
|
|
64
|
+
"form-data": "4.0.0",
|
|
65
|
+
"minimist": "1.2.8",
|
|
66
|
+
"openai": "4.28.4",
|
|
67
|
+
"picocolors": "1.0.0",
|
|
68
|
+
"uuid": "9.0.1",
|
|
69
|
+
"yargs": "17.7.2"
|
|
70
|
+
}
|
|
71
71
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
5
|
};
|
|
6
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
8
|
const path_1 = __importDefault(require("path"));
|
|
8
9
|
const minimist_1 = __importDefault(require("minimist"));
|
|
@@ -115,6 +116,14 @@ switch (engine) {
|
|
|
115
116
|
config.translationKeyInfo = {
|
|
116
117
|
kind: "openai",
|
|
117
118
|
apiKey: openaiApiKey,
|
|
119
|
+
baseUrl: (_a = process.env.ATJ_OPEN_AI_BASE_URL) !== null && _a !== void 0 ? _a : "https://api.openai.com/v1",
|
|
120
|
+
model: (_b = process.env.ATJ_OPEN_AI_MODEL) !== null && _b !== void 0 ? _b : "gpt-3.5-turbo",
|
|
121
|
+
maxTokens: Number((_c = process.env.ATJ_OPEN_AI_MAX_TOKENS) !== null && _c !== void 0 ? _c : "256"),
|
|
122
|
+
temperature: Number((_d = process.env.ATJ_OPEN_AI_TEMPERATURE) !== null && _d !== void 0 ? _d : "0"),
|
|
123
|
+
topP: Number((_e = process.env.ATJ_OPEN_AI_TOP_P) !== null && _e !== void 0 ? _e : "1.0"),
|
|
124
|
+
n: Number((_f = process.env.ATJ_OPEN_AI_N) !== null && _f !== void 0 ? _f : "1"),
|
|
125
|
+
frequencyPenalty: Number((_g = process.env.ATJ_OPEN_AI_FREQUENCY_PENALTY) !== null && _g !== void 0 ? _g : "0"),
|
|
126
|
+
presencePenalty: Number((_h = process.env.ATJ_OPEN_AI_PRESENCE_PENALTY) !== null && _h !== void 0 ? _h : "0"),
|
|
118
127
|
};
|
|
119
128
|
break;
|
|
120
129
|
}
|
|
@@ -34,5 +34,13 @@ type DeepLFreeTranslationKey = {
|
|
|
34
34
|
type OpenAITranslationKey = {
|
|
35
35
|
kind: "openai";
|
|
36
36
|
apiKey: string;
|
|
37
|
+
baseUrl: string;
|
|
38
|
+
model: string;
|
|
39
|
+
maxTokens: number;
|
|
40
|
+
temperature: number;
|
|
41
|
+
topP: number;
|
|
42
|
+
n: number;
|
|
43
|
+
frequencyPenalty: number;
|
|
44
|
+
presencePenalty: number;
|
|
37
45
|
};
|
|
38
46
|
export {};
|
|
@@ -58,6 +58,7 @@ function setDefaultConfiguration() {
|
|
|
58
58
|
config.ignorePrefix = "";
|
|
59
59
|
}
|
|
60
60
|
function setConfigurationFromEnvironment() {
|
|
61
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
61
62
|
require("dotenv").config();
|
|
62
63
|
if (process.env.ATJ_GOOGLE_API_KEY) {
|
|
63
64
|
config.translationKeyInfo = {
|
|
@@ -98,6 +99,14 @@ function setConfigurationFromEnvironment() {
|
|
|
98
99
|
config.translationKeyInfo = {
|
|
99
100
|
kind: "openai",
|
|
100
101
|
apiKey: process.env.ATJ_OPEN_AI_SECRET_KEY,
|
|
102
|
+
baseUrl: (_a = process.env.ATJ_OPEN_AI_BASE_URL) !== null && _a !== void 0 ? _a : "https://api.openai.com/v1",
|
|
103
|
+
model: (_b = process.env.ATJ_OPEN_AI_MODEL) !== null && _b !== void 0 ? _b : "gpt-3.5-turbo",
|
|
104
|
+
maxTokens: Number((_c = process.env.ATJ_OPEN_AI_MAX_TOKENS) !== null && _c !== void 0 ? _c : "256"),
|
|
105
|
+
temperature: Number((_d = process.env.ATJ_OPEN_AI_TEMPERATURE) !== null && _d !== void 0 ? _d : "0"),
|
|
106
|
+
topP: Number((_e = process.env.ATJ_OPEN_AI_TOP_P) !== null && _e !== void 0 ? _e : "1.0"),
|
|
107
|
+
n: Number((_f = process.env.ATJ_OPEN_AI_N) !== null && _f !== void 0 ? _f : "1"),
|
|
108
|
+
frequencyPenalty: Number((_g = process.env.ATJ_OPEN_AI_FREQUENCY_PENALTY) !== null && _g !== void 0 ? _g : "0"),
|
|
109
|
+
presencePenalty: Number((_h = process.env.ATJ_OPEN_AI_PRESENCE_PENALTY) !== null && _h !== void 0 ? _h : "0"),
|
|
101
110
|
};
|
|
102
111
|
}
|
|
103
112
|
if (process.env.ATJ_START_DELIMITER) {
|
package/{build/src → src}/lib.js
RENAMED
|
@@ -48,7 +48,7 @@ function translate(sourceFile, config) {
|
|
|
48
48
|
translateEngine = new deepl_1.DeepLTranslate(config.translationKeyInfo.secretKey, "pro");
|
|
49
49
|
}
|
|
50
50
|
else if (config.translationKeyInfo.kind === "openai") {
|
|
51
|
-
translateEngine = new openai_1.OpenAITranslate(config.translationKeyInfo.apiKey);
|
|
51
|
+
translateEngine = new openai_1.OpenAITranslate(config.translationKeyInfo.apiKey, config.translationKeyInfo.baseUrl, config.translationKeyInfo.model, config.translationKeyInfo.maxTokens, config.translationKeyInfo.temperature, config.translationKeyInfo.topP, config.translationKeyInfo.n, config.translationKeyInfo.presencePenalty, config.translationKeyInfo.frequencyPenalty);
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
console.warn("You must provide a Google, AWS, Azure, deepL, openai parameters first in the extension settings.");
|
package/src/openai.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ITranslate } from "./translate.interface";
|
|
2
|
+
export declare class OpenAITranslate implements ITranslate {
|
|
3
|
+
private model;
|
|
4
|
+
private maxTokens;
|
|
5
|
+
private temperature;
|
|
6
|
+
private topP;
|
|
7
|
+
private n;
|
|
8
|
+
private frequencyPenalty;
|
|
9
|
+
private presencePenalty;
|
|
10
|
+
private openai;
|
|
11
|
+
constructor(apiKey: string, baseUrl: string, model: string, maxTokens: number, temperature: number, topP: number, n: number, frequencyPenalty: number, presencePenalty: number);
|
|
12
|
+
isValidLocale(targetLocale: string): boolean;
|
|
13
|
+
translateText(text: string, sourceLocale: string, targetLocale: string): Promise<string>;
|
|
14
|
+
}
|
|
@@ -123,9 +123,17 @@ const supportedLanguages = {
|
|
|
123
123
|
zu: "Zulu",
|
|
124
124
|
};
|
|
125
125
|
class OpenAITranslate {
|
|
126
|
-
constructor(apiKey) {
|
|
126
|
+
constructor(apiKey, baseUrl, model, maxTokens, temperature, topP, n, frequencyPenalty, presencePenalty) {
|
|
127
|
+
this.model = model;
|
|
128
|
+
this.maxTokens = maxTokens;
|
|
129
|
+
this.temperature = temperature;
|
|
130
|
+
this.topP = topP;
|
|
131
|
+
this.n = n;
|
|
132
|
+
this.frequencyPenalty = frequencyPenalty;
|
|
133
|
+
this.presencePenalty = presencePenalty;
|
|
127
134
|
const configuration = {
|
|
128
135
|
apiKey: apiKey,
|
|
136
|
+
baseURL: baseUrl,
|
|
129
137
|
};
|
|
130
138
|
this.openai = new openai_1.OpenAI(configuration);
|
|
131
139
|
}
|
|
@@ -142,19 +150,28 @@ class OpenAITranslate {
|
|
|
142
150
|
({ args, text } = util_1.Util.replaceContextVariables(text));
|
|
143
151
|
const systemPrompt = `You will be provided with a sentence in English, and your task is to translate it into ${supportedLanguages[targetLocale]}`;
|
|
144
152
|
const userPrompt = text;
|
|
145
|
-
|
|
146
|
-
model:
|
|
153
|
+
let response = yield this.openai.chat.completions.create({
|
|
154
|
+
model: this.model,
|
|
147
155
|
messages: [
|
|
148
156
|
{ role: "system", content: systemPrompt },
|
|
149
157
|
{ role: "user", content: userPrompt },
|
|
150
158
|
],
|
|
151
|
-
temperature:
|
|
152
|
-
max_tokens:
|
|
153
|
-
top_p:
|
|
154
|
-
n:
|
|
155
|
-
frequency_penalty:
|
|
156
|
-
presence_penalty:
|
|
159
|
+
temperature: this.temperature,
|
|
160
|
+
max_tokens: this.maxTokens,
|
|
161
|
+
top_p: this.topP,
|
|
162
|
+
n: this.n,
|
|
163
|
+
frequency_penalty: this.frequencyPenalty,
|
|
164
|
+
presence_penalty: this.presencePenalty,
|
|
157
165
|
});
|
|
166
|
+
try {
|
|
167
|
+
console.log(response.choices[0].message.content);
|
|
168
|
+
}
|
|
169
|
+
catch (_a) {
|
|
170
|
+
// disable type script compiler for next line
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
response = JSON.parse(response);
|
|
173
|
+
console.log(response.choices[0].message.content);
|
|
174
|
+
}
|
|
158
175
|
if (response.choices[0].message.content !== null) {
|
|
159
176
|
result = util_1.Util.replaceArgumentsWithNumbers(args, response.choices[0].message.content);
|
|
160
177
|
result = result.replace(/^\n+|\n+$/g, "");
|
package/README.MD
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
# About project
|
|
2
|
-
|
|
3
|
-
This project is used in, (and refactored from) excellent vs code extension
|
|
4
|
-
Auto Translate JSON
|
|
5
|
-
<https://marketplace.visualstudio.com/items?itemName=JeffJorczak.auto-translate-json>
|
|
6
|
-
|
|
7
|
-
It opens posibility to use Auto Translation JSON
|
|
8
|
-
not just in vs code but as a library and command line interface
|
|
9
|
-
|
|
10
|
-
## Use as library
|
|
11
|
-
|
|
12
|
-
```shell
|
|
13
|
-
npm i auto-translate-json-library
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
```Typescript
|
|
17
|
-
import { translate, Configuration } from 'auto-translate-json-library';
|
|
18
|
-
|
|
19
|
-
let config: Configuration = {} as Configuration;
|
|
20
|
-
|
|
21
|
-
// set google api key
|
|
22
|
-
config.translationKeyInfo = {
|
|
23
|
-
kind: 'google',
|
|
24
|
-
apiKey: googleApiKey
|
|
25
|
-
};
|
|
26
|
-
const pivotTranslation="./en.json";
|
|
27
|
-
await translate(pivotTranslation, config) ;
|
|
28
|
-
// translation for example fr.json in same folder as pivotTranslation should contain the translations
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Use as command line tool
|
|
32
|
-
|
|
33
|
-
first install it
|
|
34
|
-
|
|
35
|
-
```shell
|
|
36
|
-
npm i auto-translate-json-library
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
do not forget to set translation engine parameters in environment variables or .env file
|
|
40
|
-
|
|
41
|
-
```shell
|
|
42
|
-
node node_modules\auto-translate-json-library\index.js --pivotTranslation=./translations/en.json
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
if you clone repo you can use the following commands
|
|
46
|
-
|
|
47
|
-
```shell
|
|
48
|
-
npm i
|
|
49
|
-
npm run build
|
|
50
|
-
node .\build\src\index.js --pivotTranslation=./tests/translations/en.json
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## CLI PARAMETERS
|
|
54
|
-
|
|
55
|
-
```config
|
|
56
|
-
mode,
|
|
57
|
-
file or folder,
|
|
58
|
-
default is file
|
|
59
|
-
|
|
60
|
-
startDelimiter,
|
|
61
|
-
start delimiter,
|
|
62
|
-
default is {
|
|
63
|
-
|
|
64
|
-
endDelimiter,
|
|
65
|
-
end delimiter,
|
|
66
|
-
default is }
|
|
67
|
-
|
|
68
|
-
keepExtraTranslations,
|
|
69
|
-
keep extra translations (not present in pivot translation),
|
|
70
|
-
default is keep,
|
|
71
|
-
it could be keep or remove
|
|
72
|
-
|
|
73
|
-
keepTranslations,
|
|
74
|
-
keep existing translations,
|
|
75
|
-
default is keep
|
|
76
|
-
it could be keep or retranslate
|
|
77
|
-
|
|
78
|
-
sourceLocale
|
|
79
|
-
source locale
|
|
80
|
-
it could be en or fr ...
|
|
81
|
-
if specified it must match with pivot translation
|
|
82
|
-
|
|
83
|
-
pivotTranslation
|
|
84
|
-
pivot translation file that will be used as source for translations
|
|
85
|
-
|
|
86
|
-
ignorePrefix
|
|
87
|
-
ignore translation that key starts with ignore prefix
|
|
88
|
-
|
|
89
|
-
# ENVIRONMENT VARIABLES
|
|
90
|
-
|
|
91
|
-
google parameters
|
|
92
|
-
ATJ_GOOGLE_API_KEY=
|
|
93
|
-
|
|
94
|
-
aws parameters
|
|
95
|
-
ATJ_AWS_ACCESS_KEY_ID=
|
|
96
|
-
ATJ_AWS_SECRET_ACCESS_KEY=
|
|
97
|
-
ATJ_AWS_REGION=
|
|
98
|
-
|
|
99
|
-
azure parameters
|
|
100
|
-
ATJ_AZURE_SECRET_KEY=
|
|
101
|
-
ATJ_AZURE_REGION=
|
|
102
|
-
|
|
103
|
-
deepl pro parameters
|
|
104
|
-
ATJ_DEEPL_PRO_SECRET_KEY=
|
|
105
|
-
deepl free parameters
|
|
106
|
-
ATJ_DEEPL_FREE_SECRET_KEY=
|
|
107
|
-
|
|
108
|
-
OpenAI parameters
|
|
109
|
-
ATJ_OPEN_AI_SECRET_KEY=
|
|
110
|
-
|
|
111
|
-
start delimiter
|
|
112
|
-
ATJ_START_DELIMITER={{
|
|
113
|
-
end delimiter
|
|
114
|
-
ATJ_END_DELIMITER=}}
|
|
115
|
-
|
|
116
|
-
file or folder
|
|
117
|
-
ATJ_MODE=file
|
|
118
|
-
|
|
119
|
-
source locale
|
|
120
|
-
ATJ_SOURCE_LOCALE=en
|
|
121
|
-
|
|
122
|
-
keep or retranslate existing translations
|
|
123
|
-
ATJ_KEEP_TRANSLATIONS=keep
|
|
124
|
-
|
|
125
|
-
keep or remove extra translations
|
|
126
|
-
ATJ_KEEP_EXTRA_TRANSLATIONS=keep
|
|
127
|
-
|
|
128
|
-
ignore prefix translation keys to ignore
|
|
129
|
-
ATJ_IGNORE_PREFIX=
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
You can also use .env file to store environment variables
|
|
133
|
-
|
|
134
|
-
There is also improved version of CLI (since version 1.3.2) for example:
|
|
135
|
-
|
|
136
|
-
```shell
|
|
137
|
-
npm install -g auto-translate-library
|
|
138
|
-
atj tests/translations/en.json -e google -m file
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
You can also use it with npx
|
|
142
|
-
|
|
143
|
-
```shell
|
|
144
|
-
npx auto-translate-library tests/translations/en.json -e google -m file
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
### Debug
|
|
148
|
-
1. Create .env file in main folder with the desired key/keys from # ENVIRONMENT VARIABLES
|
|
149
|
-
2. Add also in .env source locale "ATJ_SOURCE_LOCALE=en" to test from en
|
|
150
|
-
3. npm run debug
|
package/build/package.json
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auto-translate-json-library",
|
|
3
|
-
"version": "1.3.6",
|
|
4
|
-
"description": "Automatically translates JSON language files to other languages using Google Translate,AWS,Azure,DeepL or OpenAI",
|
|
5
|
-
"main": "./build/src/index.js",
|
|
6
|
-
"bin": {
|
|
7
|
-
"auto-translate-json-library": "./build/src/bin/cli.js",
|
|
8
|
-
"atj": "./build/src/bin/cli.js"
|
|
9
|
-
},
|
|
10
|
-
"types": "./build/src/index.d.ts",
|
|
11
|
-
"scripts": {
|
|
12
|
-
"prepare": "tsc",
|
|
13
|
-
"build": "tsc",
|
|
14
|
-
"build:run": "ts-node ./build/src/index.js --pivotTranslation=./tests/translations/en.json",
|
|
15
|
-
"debug": "ts-node src/index.ts --pivotTranslation=./tests/translations/en.json",
|
|
16
|
-
"lint": "biome check ./src",
|
|
17
|
-
"lint-fix": "biome check ./src --apply",
|
|
18
|
-
"lint-fix-all": "biome check --apply-unsafe ./src",
|
|
19
|
-
"format": "biome format ./src",
|
|
20
|
-
"format-fix": "biome format ./src --write",
|
|
21
|
-
"start": "ts-node src/index.ts"
|
|
22
|
-
},
|
|
23
|
-
"keywords": [
|
|
24
|
-
"translate",
|
|
25
|
-
"language",
|
|
26
|
-
"json",
|
|
27
|
-
"flutter",
|
|
28
|
-
"angular",
|
|
29
|
-
"ngx-translate",
|
|
30
|
-
"transloco",
|
|
31
|
-
"auto-translate-json",
|
|
32
|
-
"google",
|
|
33
|
-
"Azure",
|
|
34
|
-
"DeepL",
|
|
35
|
-
"OpenAI"
|
|
36
|
-
],
|
|
37
|
-
"author": "codegrue",
|
|
38
|
-
"repository": {
|
|
39
|
-
"type": "git",
|
|
40
|
-
"url": "https://github.com/topce/auto-translate-json-library"
|
|
41
|
-
},
|
|
42
|
-
"contributors": [
|
|
43
|
-
"codegrue",
|
|
44
|
-
"gajo357",
|
|
45
|
-
"topce",
|
|
46
|
-
"BenGMiles",
|
|
47
|
-
"stonega",
|
|
48
|
-
"alexei-petru"
|
|
49
|
-
],
|
|
50
|
-
"license": "MIT",
|
|
51
|
-
"devDependencies": {
|
|
52
|
-
"@biomejs/biome": "1.3.1",
|
|
53
|
-
"@topce/typescript": "5.3.1",
|
|
54
|
-
"@types/minimist": "1.2.4",
|
|
55
|
-
"@types/node": "20.8.9",
|
|
56
|
-
"@types/yargs": "17.0.29",
|
|
57
|
-
"ts-node": "10.9.1"
|
|
58
|
-
},
|
|
59
|
-
"dependencies": {
|
|
60
|
-
"@aws-sdk/client-translate": "3.438.0",
|
|
61
|
-
"@google-cloud/translate": "8.0.2",
|
|
62
|
-
"axios": "1.6.0",
|
|
63
|
-
"dotenv": "16.3.1",
|
|
64
|
-
"form-data": "4.0.0",
|
|
65
|
-
"minimist": "1.2.8",
|
|
66
|
-
"openai": "4.14.1",
|
|
67
|
-
"picocolors": "1.0.0",
|
|
68
|
-
"uuid": "9.0.1",
|
|
69
|
-
"yargs": "17.7.2"
|
|
70
|
-
}
|
|
71
|
-
}
|
package/build/src/openai.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ITranslate } from "./translate.interface";
|
|
2
|
-
export declare class OpenAITranslate implements ITranslate {
|
|
3
|
-
private openai;
|
|
4
|
-
constructor(apiKey: string);
|
|
5
|
-
isValidLocale(targetLocale: string): boolean;
|
|
6
|
-
translateText(text: string, sourceLocale: string, targetLocale: string): Promise<string>;
|
|
7
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|