Skip to content

Commit 72a8a69

Browse files
feat: Chinese (zh-cn) i18n support (#16)
1 parent 623df44 commit 72a8a69

11 files changed

Lines changed: 295 additions & 81 deletions

File tree

package.json

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "deepseek-v4-for-copilot",
3-
"displayName": "DeepSeek V4 for Copilot Chat",
4-
"description": "Pick DeepSeek V4 Pro & Flash from the Copilot Chat model picker. Vision, thinking mode, agent tools — zero config, BYOK.",
3+
"displayName": "%deepseek-copilot.displayName%",
4+
"description": "%deepseek-copilot.description%",
55
"icon": "resources/icon.png",
66
"version": "0.3.1",
77
"publisher": "Vizards",
@@ -49,45 +49,45 @@
4949
"languageModelChatProviders": [
5050
{
5151
"vendor": "deepseek",
52-
"displayName": "DeepSeek"
52+
"displayName": "%deepseek-copilot.providerDisplayName%"
5353
}
5454
],
5555
"commands": [
5656
{
5757
"command": "deepseek-copilot.setApiKey",
58-
"title": "DeepSeek: Set API Key"
58+
"title": "%deepseek-copilot.command.setApiKey%"
5959
},
6060
{
6161
"command": "deepseek-copilot.getApiKey",
62-
"title": "DeepSeek: Get API Key"
62+
"title": "%deepseek-copilot.command.getApiKey%"
6363
},
6464
{
6565
"command": "deepseek-copilot.clearApiKey",
66-
"title": "DeepSeek: Clear API Key"
66+
"title": "%deepseek-copilot.command.clearApiKey%"
6767
},
6868
{
6969
"command": "deepseek-copilot.setVisionModel",
70-
"title": "DeepSeek: Set Vision Proxy Model"
70+
"title": "%deepseek-copilot.command.setVisionModel%"
7171
},
7272
{
7373
"command": "deepseek-copilot.openSettings",
74-
"title": "DeepSeek: Open Settings"
74+
"title": "%deepseek-copilot.command.openSettings%"
7575
},
7676
{
7777
"command": "deepseek-copilot.showLogs",
78-
"title": "DeepSeek: Show Logs"
78+
"title": "%deepseek-copilot.command.showLogs%"
7979
}
8080
],
8181
"walkthroughs": [
8282
{
8383
"id": "deepseekGettingStarted",
84-
"title": "DeepSeek V4 for Copilot Chat",
85-
"description": "Set up DeepSeek V4 models in Copilot Chat.",
84+
"title": "%deepseek-copilot.walkthrough.title%",
85+
"description": "%deepseek-copilot.walkthrough.description%",
8686
"steps": [
8787
{
8888
"id": "setApiKey",
89-
"title": "Set your DeepSeek API key",
90-
"description": "[Get an API key](command:deepseek-copilot.getApiKey) from deepseek.com.\n[Set API Key](command:deepseek-copilot.setApiKey)",
89+
"title": "%deepseek-copilot.walkthrough.setApiKey.title%",
90+
"description": "%deepseek-copilot.walkthrough.setApiKey.description%",
9191
"media": {
9292
"markdown": "resources/walkthrough/set-api-key.md"
9393
},
@@ -97,8 +97,8 @@
9797
},
9898
{
9999
"id": "showModels",
100-
"title": "Show DeepSeek models",
101-
"description": "If the models are hidden, open VS Code's Language Models manager and show the DeepSeek models.\n[Open Language Models](command:workbench.action.chat.manage)",
100+
"title": "%deepseek-copilot.walkthrough.showModels.title%",
101+
"description": "%deepseek-copilot.walkthrough.showModels.description%",
102102
"media": {
103103
"markdown": "resources/walkthrough/show-models.md"
104104
}
@@ -107,48 +107,48 @@
107107
}
108108
],
109109
"configuration": {
110-
"title": "DeepSeek Copilot",
110+
"title": "%deepseek-copilot.config.title%",
111111
"properties": {
112112
"deepseek-copilot.baseUrl": {
113113
"type": "string",
114114
"default": "https://api.deepseek.com",
115-
"description": "DeepSeek API base URL. Defaults to official DeepSeek API endpoint."
115+
"description": "%deepseek-copilot.config.baseUrl.description%"
116116
},
117117
"deepseek-copilot.maxTokens": {
118118
"type": "number",
119119
"default": 0,
120120
"minimum": 0,
121-
"description": "Maximum number of output tokens per request. Set to 0 to use the API default (no limit). Useful for controlling costs."
121+
"description": "%deepseek-copilot.config.maxTokens.description%"
122122
},
123123
"deepseek-copilot.modelIdOverrides": {
124124
"type": "object",
125125
"default": {
126126
"deepseek-v4-flash": "deepseek-v4-flash",
127127
"deepseek-v4-pro": "deepseek-v4-pro"
128128
},
129-
"description": "Override the API model ID sent for each DeepSeek model. Defaults are prefilled with official DeepSeek IDs; change them only when using a compatible third-party API that uses different model names.",
129+
"description": "%deepseek-copilot.config.modelIdOverrides.description%",
130130
"additionalProperties": false,
131131
"properties": {
132132
"deepseek-v4-flash": {
133133
"type": "string",
134-
"description": "API model ID for DeepSeek V4 Flash"
134+
"description": "%deepseek-copilot.config.modelIdOverrides.deepseek-v4-flash.description%"
135135
},
136136
"deepseek-v4-pro": {
137137
"type": "string",
138-
"description": "API model ID for DeepSeek V4 Pro"
138+
"description": "%deepseek-copilot.config.modelIdOverrides.deepseek-v4-pro.description%"
139139
}
140140
}
141141
},
142142
"deepseek-copilot.visionModel": {
143143
"type": "string",
144144
"default": "",
145-
"description": "Model ID for vision proxy (describes images for text-only DeepSeek models). Leave empty for auto-detection. Use 'DeepSeek: Set Vision Proxy Model' command to pick one from a list."
145+
"description": "%deepseek-copilot.config.visionModel.description%"
146146
},
147147
"deepseek-copilot.visionPrompt": {
148148
"type": "string",
149149
"editPresentation": "multilineText",
150-
"default": "Describe the visual contents of this image in detail, including any text, objects, people, or context that would be relevant for understanding it. Focus on factual visual elements.",
151-
"description": "Prompt sent to the vision proxy model when describing image attachments before forwarding them to DeepSeek."
150+
"default": "%deepseek-copilot.config.visionPrompt.default%",
151+
"description": "%deepseek-copilot.config.visionPrompt.description%"
152152
}
153153
}
154154
}

package.nls.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"deepseek-copilot.displayName": "DeepSeek V4 for Copilot Chat",
3+
"deepseek-copilot.description": "Pick DeepSeek V4 Pro & Flash from the Copilot Chat model picker. Vision, thinking mode, agent tools — zero config, BYOK.",
4+
"deepseek-copilot.providerDisplayName": "DeepSeek",
5+
"deepseek-copilot.command.setApiKey": "DeepSeek: Set API Key",
6+
"deepseek-copilot.command.getApiKey": "DeepSeek: Get API Key",
7+
"deepseek-copilot.command.clearApiKey": "DeepSeek: Clear API Key",
8+
"deepseek-copilot.command.setVisionModel": "DeepSeek: Set Vision Proxy Model",
9+
"deepseek-copilot.command.openSettings": "DeepSeek: Open Settings",
10+
"deepseek-copilot.command.showLogs": "DeepSeek: Show Logs",
11+
"deepseek-copilot.walkthrough.title": "DeepSeek V4 for Copilot Chat",
12+
"deepseek-copilot.walkthrough.description": "Set up DeepSeek V4 models in Copilot Chat.",
13+
"deepseek-copilot.walkthrough.setApiKey.title": "Set your DeepSeek API key",
14+
"deepseek-copilot.walkthrough.setApiKey.description": "[Get an API key](command:deepseek-copilot.getApiKey) from deepseek.com.\n[Set API Key](command:deepseek-copilot.setApiKey)",
15+
"deepseek-copilot.walkthrough.showModels.title": "Show DeepSeek models",
16+
"deepseek-copilot.walkthrough.showModels.description": "If the models are hidden, open VS Code's Language Models manager and show the DeepSeek models.\n[Open Language Models](command:workbench.action.chat.manage)",
17+
"deepseek-copilot.config.title": "DeepSeek Copilot",
18+
"deepseek-copilot.config.baseUrl.description": "DeepSeek API base URL. Defaults to official DeepSeek API endpoint.",
19+
"deepseek-copilot.config.maxTokens.description": "Maximum number of output tokens per request. Set to 0 to use the API default (no limit). Useful for controlling costs.",
20+
"deepseek-copilot.config.modelIdOverrides.description": "Override the API model ID sent for each DeepSeek model. Defaults are prefilled with official DeepSeek IDs; change them only when using a compatible third-party API that uses different model names.",
21+
"deepseek-copilot.config.modelIdOverrides.deepseek-v4-flash.description": "API model ID for DeepSeek V4 Flash",
22+
"deepseek-copilot.config.modelIdOverrides.deepseek-v4-pro.description": "API model ID for DeepSeek V4 Pro",
23+
"deepseek-copilot.config.visionModel.description": "Model ID for vision proxy (describes images for text-only DeepSeek models). Leave empty for auto-detection. Use 'DeepSeek: Set Vision Proxy Model' command to pick one from a list.",
24+
"deepseek-copilot.config.visionPrompt.description": "Prompt sent to the vision proxy model when describing image attachments before forwarding them to DeepSeek.",
25+
"deepseek-copilot.config.visionPrompt.default": "Describe the visual contents of this image in detail, including any text, objects, people, or context that would be relevant for understanding it. Focus on factual visual elements."
26+
}

package.nls.zh-cn.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"deepseek-copilot.displayName": "DeepSeek V4 for Copilot Chat",
3+
"deepseek-copilot.description": "在 Copilot Chat 模型选择器中使用 DeepSeek V4 Pro & Flash。支持视觉识别、思考模式、智能体工具。需自行提供 API Key。",
4+
"deepseek-copilot.providerDisplayName": "DeepSeek",
5+
"deepseek-copilot.command.setApiKey": "DeepSeek: 设置 API Key",
6+
"deepseek-copilot.command.getApiKey": "DeepSeek: 获取 API Key",
7+
"deepseek-copilot.command.clearApiKey": "DeepSeek: 清除 API Key",
8+
"deepseek-copilot.command.setVisionModel": "DeepSeek: 设置视觉代理模型",
9+
"deepseek-copilot.command.openSettings": "DeepSeek: 打开设置",
10+
"deepseek-copilot.command.showLogs": "DeepSeek: 显示日志",
11+
"deepseek-copilot.walkthrough.title": "DeepSeek V4 for Copilot Chat",
12+
"deepseek-copilot.walkthrough.description": "在 Copilot Chat 中配置 DeepSeek V4 模型。",
13+
"deepseek-copilot.walkthrough.setApiKey.title": "设置你的 DeepSeek API Key",
14+
"deepseek-copilot.walkthrough.setApiKey.description": "从 deepseek.com [获取 API Key](command:deepseek-copilot.getApiKey)。\n[设置 API Key](command:deepseek-copilot.setApiKey)",
15+
"deepseek-copilot.walkthrough.showModels.title": "显示 DeepSeek 模型",
16+
"deepseek-copilot.walkthrough.showModels.description": "如果模型被隐藏,打开 VS Code 的语言模型管理器并显示 DeepSeek 模型。\n[打开语言模型管理](command:workbench.action.chat.manage)",
17+
"deepseek-copilot.config.title": "DeepSeek 助手",
18+
"deepseek-copilot.config.baseUrl.description": "DeepSeek API 基础 URL,默认为官方 DeepSeek API 端点。",
19+
"deepseek-copilot.config.maxTokens.description": "每次请求的最大输出 Token 数,设为 0 则不限制,可用于控制成本。",
20+
"deepseek-copilot.config.modelIdOverrides.description": "覆盖各 DeepSeek 模型实际使用的 API 模型 ID,默认使用官方 DeepSeek ID,仅在对接不同模型名称的第三方 API 时需要修改。",
21+
"deepseek-copilot.config.modelIdOverrides.deepseek-v4-flash.description": "DeepSeek V4 Flash 的 API 模型 ID。",
22+
"deepseek-copilot.config.modelIdOverrides.deepseek-v4-pro.description": "DeepSeek V4 Pro 的 API 模型 ID。",
23+
"deepseek-copilot.config.visionModel.description": "用于描述图片的视觉代理模型 ID,留空则自动检测,也可通过「DeepSeek: 设置视觉代理模型」命令从列表中选择。",
24+
"deepseek-copilot.config.visionPrompt.description": "在将图片附件转发给 DeepSeek 之前,发送给视觉代理模型的提示词。",
25+
"deepseek-copilot.config.visionPrompt.default": "Describe the visual contents of this image in detail, including any text, objects, people, or context that would be relevant for understanding it. Focus on factual visual elements."
26+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
DeepSeek V4 for Copilot Chat 使用你自己的 DeepSeek API Key,让 Flash 和 Pro 模型出现在模型选择器中。
2+
3+
只需粘贴一次,之后可通过命令面板更新或移除。
4+
5+
- `Cmd/Ctrl + Shift + P`:打开命令面板
6+
- `DeepSeek: Set API Key`:设置或更新 API Key
7+
- `DeepSeek: Clear API Key`:移除 API Key
8+
- `DeepSeek: Get API Key`:创建 DeepSeek API Key
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
扩展激活后,DeepSeek 模型应立即出现在 Copilot 模型选择器中。如果尚未配置 API Key,模型会显示警告图标,直到你运行 DeepSeek: Set API Key 为止。
2+
3+
如果没有立即看到,可能只是模型列表较长。在选取器中向下滚动,查找 DeepSeek V4 Flash 和 Pro。

src/auth.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import vscode from 'vscode';
22
import { API_KEY_SECRET } from './consts';
3+
import { t } from './i18n';
34

45
/**
56
* Manages DeepSeek API key via VS Code SecretStorage (secure) with
@@ -57,24 +58,24 @@ export class AuthManager {
5758
*/
5859
async promptForApiKey(): Promise<boolean> {
5960
const apiKey = await vscode.window.showInputBox({
60-
prompt: 'Enter your DeepSeek API key',
61-
placeHolder: 'sk-...',
61+
prompt: t('auth.prompt'),
62+
placeHolder: t('auth.placeholder'),
6263
password: true,
6364
ignoreFocusOut: true,
6465
validateInput: (value: string) => {
6566
if (!value?.trim()) {
66-
return 'API key cannot be empty';
67+
return t('auth.emptyValidation');
6768
}
6869
if (!value.startsWith('sk-')) {
69-
return 'API key should start with "sk-"';
70+
return t('auth.prefixValidation');
7071
}
7172
return undefined;
7273
},
7374
});
7475

7576
if (apiKey) {
7677
await this.setApiKey(apiKey);
77-
vscode.window.showInformationMessage('DeepSeek API key saved securely.');
78+
vscode.window.showInformationMessage(t('auth.saved'));
7879
return true;
7980
}
8081

src/consts.ts

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,30 +23,6 @@ export const WELCOME_SHOWN_KEY = 'deepseek-copilot.welcomeShown';
2323
/** Walkthrough contribution ID. */
2424
export const WALKTHROUGH_ID = 'Vizards.deepseek-v4-for-copilot#deepseekGettingStarted';
2525

26-
// ---- Model picker ----
27-
28-
/** Detail text shown in the model picker when no API key is configured. */
29-
export const API_KEY_REQUIRED_DETAIL = 'Please run DeepSeek: Set API Key to configure.';
30-
31-
/** Per-model configuration schema consumed by Copilot Chat's model picker. */
32-
export const THINKING_EFFORT_CONFIGURATION_SCHEMA = {
33-
properties: {
34-
reasoningEffort: {
35-
type: 'string',
36-
title: 'Thinking Effort',
37-
enum: ['none', 'high', 'max'],
38-
enumItemLabels: ['None', 'High', 'Max'],
39-
enumDescriptions: [
40-
'Disable thinking for faster responses',
41-
'Recommended for most tasks',
42-
'Maximum reasoning depth for complex agent tasks',
43-
],
44-
default: 'high',
45-
group: 'navigation',
46-
},
47-
},
48-
} as const;
49-
5026
// ---- Vision proxy ----
5127

5228
/** Default model ID used for the vision proxy when auto-detection is enabled. */
@@ -59,6 +35,13 @@ export const DEFAULT_VISION_MODEL_ID = 'oswe-vscode-prime';
5935
export const IMAGE_DESCRIPTION_PROMPT =
6036
'Describe the visual contents of this image in detail, including any text, objects, people, or context that would be relevant for understanding it. Focus on factual visual elements.';
6137

38+
/**
39+
* Stable fallback marker inserted into the chat prompt when the vision proxy
40+
* fails to describe an image. Keep this in English and out of i18n so prompt
41+
* shape and cache behaviour do not vary by VS Code display language.
42+
*/
43+
export const IMAGE_DESCRIPTION_UNAVAILABLE = '[Image Description unavailable]';
44+
6245
// ---- Cache ----
6346

6447
/** Max entries in the reasoning-content cache before eviction kicks in. */

src/extension.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import vscode from 'vscode';
22
import { WALKTHROUGH_ID, WELCOME_SHOWN_KEY } from './consts';
3+
import { t } from './i18n';
34
import { logger } from './logger';
45
import { DeepSeekChatProvider } from './provider';
56

@@ -53,16 +54,14 @@ export function activate(context: vscode.ExtensionContext) {
5354
provider.refreshModelPicker();
5455

5556
void showWelcomeIfNeeded(context, provider).catch((error) => {
56-
logger.warn('Failed to show DeepSeek welcome prompt', error);
57+
logger.warn(t('extension.welcomeFailed'), error);
5758
});
5859

5960
logger.info('Extension activated');
6061
} catch (error) {
6162
activeProvider = undefined;
6263
logger.error('Failed to activate DeepSeek extension', error);
63-
void vscode.window.showErrorMessage(
64-
'DeepSeek failed to activate. Run "DeepSeek: Show Logs" for details.',
65-
);
64+
void vscode.window.showErrorMessage(t('extension.activateFailed'));
6665
throw error;
6766
}
6867
}
@@ -87,7 +86,7 @@ export async function deactivate() {
8786
try {
8887
await activeProvider?.prepareForDeactivate();
8988
} catch (error) {
90-
logger.warn('Failed to prepare DeepSeek provider for deactivate', error);
89+
logger.warn(t('extension.deactivateFailed'), error);
9190
} finally {
9291
activeProvider = undefined;
9392
logger.info('Extension deactivated');

0 commit comments

Comments
 (0)