-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathpackage.json
More file actions
384 lines (384 loc) · 12.2 KB
/
package.json
File metadata and controls
384 lines (384 loc) · 12.2 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
{
"name": "var-translation",
"displayName": "驼峰翻译助手",
"description": "快速将中文变量翻译名转换为多种常用驼峰命名格式(如 camelCase、PascalCase、snake_case 等)。同时,支持 腾讯 百度 OpenAI API 自定义翻译模型提升开发效率。",
"publisher": "svenzhao",
"icon": "images/logo.png",
"version": "1.1.0",
"engines": {
"vscode": "^1.90.0"
},
"categories": [
"Other"
],
"keywords": [
"translate",
"variable",
"camel",
"var",
"翻译",
"变量",
"驼峰",
"var-translation"
],
"activationEvents": [
"onStartupFinished"
],
"main": "./dist/extension.js",
"contributes": {
"keybindings": [
{
"command": "extension.varTranslation",
"key": "Alt+shift+t",
"mac": "cmd+shift+t"
}
],
"commands": [
{
"command": "extension.varTranslation",
"title": "驼峰命名转换",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.camelCase",
"title": "camelCase 驼峰(小) camelCase",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.pascalCase",
"title": "pascalCase 驼峰(大) PascalCase",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.paramCase",
"title": "paramCase 中划线(小) param-case",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.snakeCase",
"title": "snakeCase 下划线 snake_case",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.constantCase",
"title": "constantCase 常量 CONSTANT_CASE",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.capitalCase",
"title": "capitalCase 分词(大) Capital Case",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.dotCase",
"title": "dotCase 对象属性 dot case",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.headerCase",
"title": "headerCase 中划线(大) Header-Case",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.noCase",
"title": "noCase 分词(小) no case",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.pathCase",
"title": "pathCase 文件路径 path/case",
"when": "editorTextFocus",
"category": "var-translation"
},
{
"command": "extension.varTranslation.selectCopilotModel",
"title": "选择 Copilot 模型",
"category": "var-translation"
},
{
"command": "extension.varTranslation.configEngine",
"title": "配置翻译引擎",
"category": "var-translation"
},
{
"command": "extension.varTranslation.switchEngine",
"title": "切换翻译引擎",
"category": "var-translation"
},
{
"command": "extension.varTranslation.history",
"title": "翻译历史",
"category": "var-translation"
},
{
"command": "extension.varTranslation.clearCache",
"title": "清空翻译缓存",
"category": "var-translation"
}
],
"submenus": [
{
"id": "var-translation.menulist",
"label": "驼峰翻译"
}
],
"menus": {
"editor/context": [
{
"submenu": "var-translation.menulist",
"when": "editorTextFocus"
}
],
"var-translation.menulist": [
{
"command": "extension.varTranslation",
"group": "1",
"title": "选择翻译"
},
{
"command": "extension.varTranslation.camelCase",
"group": "2",
"title": "camelCase 驼峰(小) camelCase"
},
{
"command": "extension.varTranslation.pascalCase",
"group": "3",
"title": "pascalCase 驼峰(大) PascalCase"
},
{
"command": "extension.varTranslation.paramCase",
"group": "4",
"title": "paramCase 中划线(小) param-case"
},
{
"command": "extension.varTranslation.snakeCase",
"group": "5",
"title": "snakeCase 下划线 snake_case"
},
{
"command": "extension.varTranslation.constantCase",
"group": "6",
"title": "constantCase 常量 CONSTANT_CASE"
},
{
"command": "extension.varTranslation.capitalCase",
"group": "7",
"title": "capitalCase 分词(大) Capital Case"
},
{
"command": "extension.varTranslation.dotCase",
"group": "8",
"title": "dotCase 对象属性 dot case"
},
{
"command": "extension.varTranslation.headerCase",
"group": "9",
"title": "headerCase 中划线(大) Header-Case"
},
{
"command": "extension.varTranslation.noCase",
"group": "10",
"title": "noCase 分词(小) no case"
},
{
"command": "extension.varTranslation.pathCase",
"group": "11",
"title": "pathCase 文件路径 path/case"
}
]
},
"configuration": {
"type": "object",
"title": "驼峰翻译配置",
"properties": {
"varTranslation.translationEngine": {
"type": "string",
"enum": [
"copilot",
"ChatGpt",
"google",
"bing",
"deeplx",
"baidu",
"tencent",
"libretranslate"
],
"enumDescriptions": [
"VS Code Copilot(零配置,推荐)",
"ChatGPT / OpenAI 兼容",
"谷歌翻译(免费)",
"Bing / Azure Translator",
"DeepLX",
"百度翻译",
"腾讯翻译君",
"LibreTranslate 自建翻译"
],
"default": "google",
"description": "翻译引擎",
"order": 0
},
"varTranslation.targetLanguage": {
"type": "string",
"default": "zh",
"description": "英文变量名翻译的目标语言(如 zh 中文、ja 日文、ko 韩文、fr 法文、de 德文等)",
"order": 1
},
"varTranslation.copilot.model": {
"type": "string",
"default": "",
"description": "Copilot 模型 ID,留空自动选择。可通过命令「选择 Copilot 模型」设置",
"order": 10
},
"varTranslation.openai.apiKey": {
"type": "string",
"default": "",
"description": "OpenAI API Key(sk- 开头的字符串)",
"order": 20
},
"varTranslation.openai.apiBaseUrl": {
"type": "string",
"default": "",
"description": "OpenAI API 基础 URL(如 https://api.openai.com/v1),留空使用官方地址",
"order": 21
},
"varTranslation.openai.model": {
"type": "string",
"default": "gpt-3.5-turbo",
"description": "OpenAI 模型名称",
"order": 22
},
"varTranslation.google.tld": {
"type": "string",
"default": "com",
"description": "谷歌翻译的顶级域名,如 com、cn 等",
"order": 30
},
"varTranslation.bing.subscriptionKey": {
"type": "string",
"default": "",
"description": "Azure Translator 订阅密钥(每月 200 万字符免费额度)",
"order": 40
},
"varTranslation.bing.region": {
"type": "string",
"default": "global",
"description": "Azure Translator 区域(如 global、eastasia 等)",
"order": 41
},
"varTranslation.deeplx.apiBaseUrl": {
"type": "string",
"default": "http://localhost:5000/translate",
"description": "DeepLX API 地址",
"order": 50
},
"varTranslation.baidu.appId": {
"type": "string",
"default": "",
"description": "百度翻译 App ID(申请地址:https://hcfy.app/docs/services/baidu-api)",
"order": 60
},
"varTranslation.baidu.secretKey": {
"type": "string",
"default": "",
"description": "百度翻译 Secret Key",
"order": 61
},
"varTranslation.tencent.secretId": {
"type": "string",
"default": "",
"description": "腾讯翻译君 Secret ID(申请地址:https://hcfy.app/docs/services/qq-api)",
"order": 70
},
"varTranslation.tencent.secretKey": {
"type": "string",
"default": "",
"description": "腾讯翻译君 Secret Key",
"order": 71
},
"varTranslation.libretranslate.apiBaseUrl": {
"type": "string",
"default": "http://localhost:5000/translate",
"description": "LibreTranslate API 地址(仓库:https://github.com/LibreTranslate/LibreTranslate)",
"order": 80
},
"varTranslation.libretranslate.apiKey": {
"type": "string",
"default": "",
"description": "LibreTranslate API Key(如果开启了 Key 验证)",
"order": 81
},
"varTranslation.baiduSecret": {
"type": "string",
"default": "",
"description": "(已废弃,请使用 baidu.appId 和 baidu.secretKey)百度翻译密钥",
"deprecationMessage": "此配置项已废弃,请使用 varTranslation.baidu.appId 和 varTranslation.baidu.secretKey"
},
"varTranslation.tencentSecret": {
"type": "string",
"default": "",
"description": "(已废弃,请使用 tencent.secretId 和 tencent.secretKey)腾讯翻译密钥",
"deprecationMessage": "此配置项已废弃,请使用 varTranslation.tencent.secretId 和 varTranslation.tencent.secretKey"
},
"varTranslation.googleTld": {
"type": "string",
"default": "",
"description": "(已废弃,请使用 google.tld)谷歌翻译顶级域名",
"deprecationMessage": "此配置项已废弃,请使用 varTranslation.google.tld"
}
}
}
},
"scripts": {
"vscode:prepublish": "npm run package",
"compile": "webpack --devtool nosources-source-map --config ./build/node-extension.webpack.config.js",
"watch": "webpack --watch --devtool nosources-source-map --config ./build/node-extension.webpack.config.js",
"package": "webpack --mode production --config ./build/node-extension.webpack.config.js",
"lint": "eslint src --ext ts",
"test": "node scripts/test-engine.js",
"release": "standard-version",
"publish": "npm run release && vsce publish",
"f2elint-scan": "f2elint scan",
"f2elint-fix": "f2elint fix"
},
"devDependencies": {
"@types/google-translate-api": "^2.3.1",
"@types/node": "^20.0.0",
"@types/vscode": "^1.90.0",
"@vscode/test-electron": "^2.4.0",
"f2elint": "^4.9.0",
"standard-version": "^9.1.0",
"ts-loader": "^9.5.0",
"typescript": "^5.5.0",
"webpack": "^5.10.0",
"webpack-cli": "^4.2.0"
},
"dependencies": {
"@asmagin/google-translate-api": "^8.0.2",
"axios": "^1.6.5",
"change-case": "^4.1.2",
"node-baidu-translate": "^0.1.0",
"openai": "^4.0.0",
"tencentcloud-sdk-nodejs": "^4.0.331"
},
"repository": {
"type": "git",
"url": "https://github.com/SvenZhao/var-translation"
},
"homepage": "https://github.com/SvenZhao/var-translation/blob/master/README.md",
"husky": {
"hooks": {
"pre-commit": "f2elint commit-file-scan",
"commit-msg": "f2elint commit-msg-scan"
}
}
}