opencode-cn 1.2.10

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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,225 @@
1
+ # OpenCode 中文翻译插件
2
+
3
+ OpenCode 的中文本地化插件,为已安装的 OpenCode 提供中文界面支持。
4
+ 后续几天会更新一键安装包,方便大家使用
5
+ ## 功能特点
6
+
7
+ - 模块化翻译配置,易于维护
8
+ - 自动检测 OpenCode 安装路径
9
+ - **版本匹配检测** - 自动检测 OpenCode 版本是否与翻译插件兼容
10
+ - **自动安装 OpenCode** - 未安装时可自动克隆并安装
11
+ - **升级支持** - 支持升级 OpenCode 并重新应用翻译
12
+ - 精确文件定位,避免误替换
13
+
14
+ ## 前置要求
15
+
16
+ - [Node.js](https://nodejs.org/) >= 18.0.0
17
+ - [Bun](https://bun.sh/)(安装脚本会自动安装)
18
+ - [Git](https://git-scm.com/)
19
+
20
+ ## 安装
21
+
22
+ ### 方式一:NPM 安装(推荐)
23
+
24
+ ```bash
25
+ npm install -g opencode-cn
26
+ ```
27
+
28
+ ### 方式二:Bun 安装
29
+
30
+ ```bash
31
+ bun install -g opencode-cn
32
+ ```
33
+
34
+ ### 方式三:手动安装
35
+
36
+ ```bash
37
+ # 克隆仓库
38
+ git clone https://github.com/huangzejian365/opencode-cn.git
39
+ cd opencode-cn
40
+
41
+ # 安装依赖
42
+ npm install
43
+ ```
44
+
45
+ ## 使用方法
46
+
47
+ ### 完整流程(推荐)
48
+
49
+ ```bash
50
+ # 1. 自动安装 OpenCode(如果未安装)
51
+ opencode-cn-localize --install
52
+
53
+ # 2. 翻译并构建(一步完成)
54
+ opencode-cn-localize
55
+ ```
56
+
57
+ ### 命令参数
58
+
59
+ | 参数 | 说明 |
60
+ |------|------|
61
+ | `--install` | 自动安装 OpenCode 到 `~/.opencode-cn/opencode` |
62
+ | `--upgrade` | 升级 OpenCode 到最新版本 |
63
+ | `--no-build` | 仅翻译不构建 |
64
+
65
+ ### 示例
66
+
67
+ ```bash
68
+ # 自动安装 OpenCode
69
+ opencode-cn-localize --install
70
+
71
+ # 翻译并构建(默认)
72
+ opencode-cn-localize
73
+
74
+ # 仅翻译不构建
75
+ opencode-cn-localize --no-build
76
+
77
+ # 升级 OpenCode
78
+ opencode-cn-localize --upgrade
79
+
80
+ # 升级后重新翻译
81
+ opencode-cn-localize
82
+ ```
83
+
84
+ ## 版本匹配
85
+
86
+ 运行翻译插件时,会自动检测 OpenCode 版本是否与翻译插件支持的版本匹配:
87
+
88
+ ```
89
+ OpenCode version: 1.2.10
90
+ Translation config version: 1.2.10
91
+ ✓ 版本匹配!OpenCode: 1.2.10
92
+ ```
93
+
94
+ 如果版本不匹配,会显示警告但不会阻止执行:
95
+
96
+ ```
97
+ ⚠ 版本不匹配!
98
+ OpenCode: 1.2.11
99
+ 翻译插件: 1.2.10
100
+ 可能存在未翻译的内容
101
+ ```
102
+
103
+ ## 升级流程
104
+
105
+ 当 OpenCode 发布新版本时:
106
+
107
+ ```bash
108
+ # 1. 升级 OpenCode 源码
109
+ opencode-cn-localize --upgrade
110
+
111
+ # 2. 重新翻译并构建
112
+ opencode-cn-localize
113
+ ```
114
+
115
+ > **注意**:升级后如果版本不匹配,可能存在未翻译的新内容。请关注翻译插件更新。
116
+
117
+ ### 环境变量
118
+
119
+ | 变量 | 说明 | 默认值 |
120
+ |------|------|--------|
121
+ | `OPENCODE_SOURCE_DIR` | OpenCode 源码目录 | 自动检测 |
122
+
123
+ ### 自动检测路径顺序
124
+
125
+ 1. `OPENCODE_SOURCE_DIR` 环境变量
126
+ 2. `~/.opencode-cn/opencode`
127
+ 3. `/root/opencode/packages/opencode`
128
+ 4. `~/opencode/packages/opencode`
129
+ 5. `~/.opencode/opencode/packages/opencode`
130
+
131
+ ## 项目结构
132
+
133
+ ```
134
+ opencode-cn/
135
+ ├── translations/
136
+ │ ├── config.json # 主配置文件
137
+ │ ├── app.json # 应用主入口
138
+ │ ├── dialogs/ # 对话框组件
139
+ │ ├── components/ # UI 组件
140
+ │ ├── routes/ # 路由页面
141
+ │ └── common/ # 通用消息
142
+ ├── localize.ts # 翻译脚本
143
+ ├── tsconfig.json
144
+ └── package.json
145
+ ```
146
+
147
+ ## 翻译配置格式
148
+
149
+ 每个翻译文件包含以下结构:
150
+
151
+ ```json
152
+ {
153
+ "file": "src/cli/cmd/tui/component/dialog-provider.tsx",
154
+ "description": "提供商连接对话框",
155
+ "replacements": {
156
+ "title=\"Select auth method\"": "title=\"选择认证方式\"",
157
+ "placeholder=\"API key\"": "placeholder=\"API密钥\""
158
+ }
159
+ }
160
+ ```
161
+
162
+ ## 贡献翻译
163
+
164
+ 1. Fork 本仓库
165
+ 2. 在 `translations/` 目录下创建或编辑翻译文件
166
+ 3. 更新 `translations/config.json` 中的版本号
167
+ 4. 运行 `bun run localize.ts` 测试
168
+ 5. 提交 Pull Request
169
+
170
+ ## 常见问题
171
+
172
+ ### Q: 翻译后部分内容仍显示英文?
173
+
174
+ A: 可能是:
175
+ 1. 新增内容尚未翻译 - 可以提交 Issue 报告
176
+ 2. 版本不匹配 - 检查 `translations/config.json` 中的版本是否与 OpenCode 一致
177
+
178
+ ### Q: 如何恢复英文版?
179
+
180
+ A: 重新克隆或更新 OpenCode 源码:
181
+ ```bash
182
+ rm -rf ~/.opencode-cn/opencode
183
+ opencode-cn-localize --install
184
+ ```
185
+
186
+ ### Q: 翻译脚本找不到 OpenCode?
187
+
188
+ A: 设置环境变量指定路径:
189
+ ```bash
190
+ OPENCODE_SOURCE_DIR=/path/to/opencode opencode-cn-localize
191
+ ```
192
+
193
+ ### Q: 升级后翻译丢失?
194
+
195
+ A: 升级会重置源码,需要重新运行翻译:
196
+ ```bash
197
+ opencode-cn-localize --upgrade
198
+ opencode-cn-localize
199
+ ```
200
+
201
+ ### Q: 支持哪些平台?
202
+
203
+ A: 支持 Linux (x64, arm64)、macOS (x64, arm64)、Windows (x64)
204
+
205
+ ## 开发
206
+
207
+ ```bash
208
+ # 克隆仓库
209
+ git clone https://github.com/huangzejian365/opencode-cn.git
210
+ cd opencode-cn
211
+
212
+ # 安装依赖
213
+ npm install
214
+
215
+ # 运行翻译脚本
216
+ OPENCODE_SOURCE_DIR=/path/to/opencode bun run localize.ts
217
+ ```
218
+
219
+ ## 许可证
220
+
221
+ MIT License
222
+
223
+ ## 致谢
224
+
225
+ - [OpenCode](https://github.com/anomalyco/opencode) - 原始项目
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=localize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localize.d.ts","sourceRoot":"","sources":["../localize.ts"],"names":[],"mappings":""}
@@ -0,0 +1,469 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const fs_1 = __importDefault(require("fs"));
7
+ const path_1 = __importDefault(require("path"));
8
+ const os_1 = __importDefault(require("os"));
9
+ const child_process_1 = require("child_process");
10
+ const CYAN = "\x1b[36m";
11
+ const GREEN = "\x1b[32m";
12
+ const YELLOW = "\x1b[33m";
13
+ const RED = "\x1b[31m";
14
+ const NC = "\x1b[0m";
15
+ function log(color, message) {
16
+ console.log(`${color}${message}${NC}`);
17
+ }
18
+ function getOpenCodeDir() {
19
+ if (process.env.OPENCODE_SOURCE_DIR) {
20
+ return process.env.OPENCODE_SOURCE_DIR;
21
+ }
22
+ const homeDir = os_1.default.homedir();
23
+ const defaultDir = path_1.default.join(homeDir, ".opencode-cn", "opencode");
24
+ if (fs_1.default.existsSync(defaultDir)) {
25
+ return defaultDir;
26
+ }
27
+ const possiblePaths = [
28
+ "/root/opencode/packages/opencode",
29
+ path_1.default.join(homeDir, "opencode", "packages", "opencode"),
30
+ path_1.default.join(homeDir, ".opencode", "packages", "opencode"),
31
+ ];
32
+ for (const p of possiblePaths) {
33
+ if (fs_1.default.existsSync(p)) {
34
+ return path_1.default.dirname(path_1.default.dirname(p));
35
+ }
36
+ }
37
+ return null;
38
+ }
39
+ function getTranslationsDir() {
40
+ const scriptDir = __dirname;
41
+ const translationsDir = path_1.default.join(scriptDir, "translations");
42
+ if (fs_1.default.existsSync(translationsDir)) {
43
+ return translationsDir;
44
+ }
45
+ throw new Error(`Translations directory not found: ${translationsDir}`);
46
+ }
47
+ function loadModuleConfig(translationsDir) {
48
+ const configPath = path_1.default.join(translationsDir, "config.json");
49
+ if (!fs_1.default.existsSync(configPath)) {
50
+ throw new Error(`Module config not found: ${configPath}`);
51
+ }
52
+ return JSON.parse(fs_1.default.readFileSync(configPath, "utf-8"));
53
+ }
54
+ function loadTranslationFile(translationsDir, relativePath) {
55
+ const filePath = path_1.default.join(translationsDir, relativePath);
56
+ if (!fs_1.default.existsSync(filePath)) {
57
+ console.log(` Warning: Translation file not found: ${relativePath}`);
58
+ return null;
59
+ }
60
+ return JSON.parse(fs_1.default.readFileSync(filePath, "utf-8"));
61
+ }
62
+ function escapeRegex(str) {
63
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
64
+ }
65
+ function applyTranslation(opencodeDir, config, relativeFilePath) {
66
+ const targetFile = relativeFilePath || config.file;
67
+ if (!targetFile) {
68
+ return { file: "unknown", replacements: 0, skipped: true, reason: "No file specified" };
69
+ }
70
+ let relativePath = targetFile;
71
+ if (relativePath.startsWith("src/")) {
72
+ relativePath = path_1.default.join("packages", "opencode", targetFile);
73
+ }
74
+ else if (!relativePath.startsWith("packages/")) {
75
+ relativePath = path_1.default.join("packages", "opencode", targetFile);
76
+ }
77
+ const filePath = path_1.default.join(opencodeDir, relativePath);
78
+ if (!fs_1.default.existsSync(filePath)) {
79
+ return { file: targetFile, replacements: 0, skipped: true, reason: "File not found" };
80
+ }
81
+ let content = fs_1.default.readFileSync(filePath, "utf-8");
82
+ let totalReplacements = 0;
83
+ for (const [original, translated] of Object.entries(config.replacements)) {
84
+ if (original === translated)
85
+ continue;
86
+ const escapedOriginal = escapeRegex(original);
87
+ const regex = new RegExp(escapedOriginal, "g");
88
+ const matches = content.match(regex);
89
+ if (matches) {
90
+ content = content.replace(regex, translated);
91
+ totalReplacements += matches.length;
92
+ }
93
+ }
94
+ if (totalReplacements > 0) {
95
+ fs_1.default.writeFileSync(filePath, content);
96
+ }
97
+ return { file: targetFile, replacements: totalReplacements, skipped: false };
98
+ }
99
+ function getOpenCodeVersion(opencodeDir) {
100
+ try {
101
+ const packageJsonPath = path_1.default.join(opencodeDir, "packages", "opencode", "package.json");
102
+ if (fs_1.default.existsSync(packageJsonPath)) {
103
+ const packageJson = JSON.parse(fs_1.default.readFileSync(packageJsonPath, "utf-8"));
104
+ return packageJson.version;
105
+ }
106
+ }
107
+ catch { }
108
+ return "unknown";
109
+ }
110
+ function checkCommand(cmd) {
111
+ try {
112
+ (0, child_process_1.execSync)(`which ${cmd}`, { stdio: "ignore" });
113
+ return true;
114
+ }
115
+ catch {
116
+ return false;
117
+ }
118
+ }
119
+ function installOpenCode(targetDir) {
120
+ return new Promise((resolve, reject) => {
121
+ log(CYAN, "\n[1/4] 检查系统环境...");
122
+ if (!checkCommand("git")) {
123
+ log(RED, "错误: 未找到 Git,请先安装 Git");
124
+ reject(new Error("Git not found"));
125
+ return;
126
+ }
127
+ if (!checkCommand("bun")) {
128
+ log(YELLOW, "未找到 Bun,正在安装...");
129
+ try {
130
+ (0, child_process_1.execSync)("npm install -g bun", { stdio: "inherit" });
131
+ log(GREEN, "✓ Bun 安装完成\n");
132
+ }
133
+ catch (error) {
134
+ log(RED, "Bun 安装失败");
135
+ reject(error);
136
+ return;
137
+ }
138
+ }
139
+ else {
140
+ log(GREEN, "✓ 环境检查完成\n");
141
+ }
142
+ log(CYAN, "[2/4] 克隆 OpenCode 源码...");
143
+ const cloneProcess = (0, child_process_1.spawn)("git", ["clone", "--depth", "1", "https://github.com/anomalyco/opencode.git", targetDir], {
144
+ stdio: "inherit"
145
+ });
146
+ cloneProcess.on("close", (code) => {
147
+ if (code !== 0) {
148
+ log(RED, `克隆失败,退出码: ${code}`);
149
+ reject(new Error(`Git clone failed with code ${code}`));
150
+ return;
151
+ }
152
+ log(GREEN, "✓ 源码克隆完成\n");
153
+ log(CYAN, "[3/4] 安装依赖...");
154
+ const installProcess = (0, child_process_1.spawn)("bun", ["install"], {
155
+ cwd: targetDir,
156
+ stdio: "inherit"
157
+ });
158
+ installProcess.on("close", (code) => {
159
+ if (code !== 0) {
160
+ log(RED, `依赖安装失败,退出码: ${code}`);
161
+ reject(new Error(`Bun install failed with code ${code}`));
162
+ return;
163
+ }
164
+ log(GREEN, "✓ 依赖安装完成\n");
165
+ log(CYAN, "[4/4] 检查版本匹配...");
166
+ const installedVersion = getOpenCodeVersion(targetDir);
167
+ const translationsDir = getTranslationsDir();
168
+ const moduleConfig = loadModuleConfig(translationsDir);
169
+ if (installedVersion === moduleConfig.version) {
170
+ log(GREEN, `✓ 版本匹配!OpenCode: ${installedVersion}\n`);
171
+ resolve(true);
172
+ }
173
+ else {
174
+ log(YELLOW, `⚠ 版本不匹配!`);
175
+ log(YELLOW, ` OpenCode: ${installedVersion}`);
176
+ log(YELLOW, ` 翻译插件: ${moduleConfig.version}`);
177
+ log(YELLOW, ` 可能存在未翻译的内容\n`);
178
+ resolve(true);
179
+ }
180
+ });
181
+ installProcess.on("error", (error) => {
182
+ log(RED, `依赖安装错误: ${error.message}`);
183
+ reject(error);
184
+ });
185
+ });
186
+ cloneProcess.on("error", (error) => {
187
+ log(RED, `克隆错误: ${error.message}`);
188
+ reject(error);
189
+ });
190
+ });
191
+ }
192
+ function upgradeOpenCode(opencodeDir) {
193
+ return new Promise((resolve, reject) => {
194
+ log(CYAN, "\n[1/3] 拉取最新代码...");
195
+ const fetchProcess = (0, child_process_1.spawn)("git", ["fetch", "origin"], {
196
+ cwd: opencodeDir,
197
+ stdio: "inherit"
198
+ });
199
+ fetchProcess.on("close", (code) => {
200
+ if (code !== 0) {
201
+ log(RED, `拉取失败,退出码: ${code}`);
202
+ reject(new Error(`Git fetch failed with code ${code}`));
203
+ return;
204
+ }
205
+ log(GREEN, "✓ 代码拉取完成\n");
206
+ log(CYAN, "[2/3] 检查版本...");
207
+ const currentVersion = getOpenCodeVersion(opencodeDir);
208
+ const translationsDir = getTranslationsDir();
209
+ const moduleConfig = loadModuleConfig(translationsDir);
210
+ try {
211
+ const latestVersion = (0, child_process_1.execSync)("git describe --tags --abbrev=0 origin/main", {
212
+ cwd: opencodeDir,
213
+ encoding: "utf-8"
214
+ }).trim().replace(/^v/, "");
215
+ log(YELLOW, ` 当前版本: ${currentVersion}`);
216
+ log(YELLOW, ` 最新版本: ${latestVersion}`);
217
+ if (currentVersion === latestVersion) {
218
+ log(GREEN, "✓ 已经是最新版本\n");
219
+ resolve(true);
220
+ return;
221
+ }
222
+ }
223
+ catch {
224
+ log(YELLOW, " 无法获取最新版本信息\n");
225
+ }
226
+ log(CYAN, "[3/3] 更新并重新安装依赖...");
227
+ const resetProcess = (0, child_process_1.spawn)("git", ["reset", "--hard", "origin/main"], {
228
+ cwd: opencodeDir,
229
+ stdio: "inherit"
230
+ });
231
+ resetProcess.on("close", (code) => {
232
+ if (code !== 0) {
233
+ log(RED, `更新失败,退出码: ${code}`);
234
+ reject(new Error(`Git reset failed with code ${code}`));
235
+ return;
236
+ }
237
+ const installProcess = (0, child_process_1.spawn)("bun", ["install"], {
238
+ cwd: opencodeDir,
239
+ stdio: "inherit"
240
+ });
241
+ installProcess.on("close", (code) => {
242
+ if (code !== 0) {
243
+ log(RED, `依赖安装失败,退出码: ${code}`);
244
+ reject(new Error(`Bun install failed with code ${code}`));
245
+ return;
246
+ }
247
+ const newVersion = getOpenCodeVersion(opencodeDir);
248
+ log(GREEN, `✓ 更新完成!新版本: ${newVersion}\n`);
249
+ if (newVersion !== moduleConfig.version) {
250
+ log(YELLOW, `⚠ 版本不匹配!`);
251
+ log(YELLOW, ` OpenCode: ${newVersion}`);
252
+ log(YELLOW, ` 翻译插件: ${moduleConfig.version}`);
253
+ log(YELLOW, ` 可能存在未翻译的内容\n`);
254
+ }
255
+ resolve(true);
256
+ });
257
+ installProcess.on("error", (error) => {
258
+ log(RED, `依赖安装错误: ${error.message}`);
259
+ reject(error);
260
+ });
261
+ });
262
+ resetProcess.on("error", (error) => {
263
+ log(RED, `更新错误: ${error.message}`);
264
+ reject(error);
265
+ });
266
+ });
267
+ fetchProcess.on("error", (error) => {
268
+ log(RED, `拉取错误: ${error.message}`);
269
+ reject(error);
270
+ });
271
+ });
272
+ }
273
+ function buildOpenCode(opencodeDir) {
274
+ return new Promise((resolve, reject) => {
275
+ console.log("\nBuilding OpenCode...");
276
+ const buildProcess = (0, child_process_1.spawn)("bun", ["run", "build"], {
277
+ cwd: path_1.default.join(opencodeDir, "packages", "opencode"),
278
+ stdio: "inherit",
279
+ env: process.env
280
+ });
281
+ buildProcess.on("close", (code) => {
282
+ if (code === 0) {
283
+ console.log("\n✓ Build completed successfully!");
284
+ resolve(code);
285
+ }
286
+ else {
287
+ console.log(`\n✗ Build failed with exit code ${code}`);
288
+ reject(new Error(`Build failed with exit code ${code}`));
289
+ }
290
+ });
291
+ buildProcess.on("error", (error) => {
292
+ console.error(`\n✗ Build error: ${error.message}`);
293
+ reject(error);
294
+ });
295
+ });
296
+ }
297
+ async function main() {
298
+ console.log("OpenCode Chinese Localization Tool");
299
+ console.log("==================================\n");
300
+ const args = process.argv.slice(2);
301
+ const noBuild = args.includes("--no-build");
302
+ const upgrade = args.includes("--upgrade");
303
+ const install = args.includes("--install");
304
+ if (install) {
305
+ log(CYAN, "╔══════════════════════════════════════════════════════════════╗");
306
+ log(CYAN, "║ OpenCode 中文版 安装程序 ║");
307
+ log(CYAN, "║ OpenCode Chinese Version Installer ║");
308
+ log(CYAN, "╚══════════════════════════════════════════════════════════════╝\n");
309
+ const homeDir = os_1.default.homedir();
310
+ const installDir = path_1.default.join(homeDir, ".opencode-cn", "opencode");
311
+ try {
312
+ await installOpenCode(installDir);
313
+ console.log("\n╔══════════════════════════════════════════════════════════════╗");
314
+ console.log("║ 安装完成! ║");
315
+ console.log("║ Installation Complete! ║");
316
+ console.log("╠══════════════════════════════════════════════════════════════╣");
317
+ console.log("║ ║");
318
+ console.log("║ 下一步: ║");
319
+ console.log("║ opencode-cn-localize ║");
320
+ console.log("║ ║");
321
+ console.log("╚══════════════════════════════════════════════════════════════╝\n");
322
+ }
323
+ catch (error) {
324
+ log(RED, `\n安装失败: ${error.message}`);
325
+ process.exit(1);
326
+ }
327
+ return;
328
+ }
329
+ if (upgrade) {
330
+ log(CYAN, "╔══════════════════════════════════════════════════════════════╗");
331
+ log(CYAN, "║ OpenCode 中文版 升级程序 ║");
332
+ log(CYAN, "║ OpenCode Chinese Version Upgrader ║");
333
+ log(CYAN, "╚══════════════════════════════════════════════════════════════╝\n");
334
+ let opencodeDir;
335
+ try {
336
+ opencodeDir = getOpenCodeDir();
337
+ if (!opencodeDir) {
338
+ log(RED, "错误: 未找到 OpenCode 安装目录");
339
+ log(YELLOW, "请先运行: opencode-cn-localize --install");
340
+ process.exit(1);
341
+ return;
342
+ }
343
+ console.log(`OpenCode directory: ${opencodeDir}`);
344
+ }
345
+ catch (e) {
346
+ log(RED, `Error: ${e.message}`);
347
+ process.exit(1);
348
+ }
349
+ try {
350
+ await upgradeOpenCode(opencodeDir);
351
+ console.log("\n╔══════════════════════════════════════════════════════════════╗");
352
+ console.log("║ 升级完成! ║");
353
+ console.log("║ Upgrade Complete! ║");
354
+ console.log("╠══════════════════════════════════════════════════════════════╣");
355
+ console.log("║ ║");
356
+ console.log("║ 下一步: ║");
357
+ console.log("║ opencode-cn-localize ║");
358
+ console.log("║ ║");
359
+ console.log("╚══════════════════════════════════════════════════════════════╝\n");
360
+ }
361
+ catch (error) {
362
+ log(RED, `\n升级失败: ${error.message}`);
363
+ process.exit(1);
364
+ }
365
+ return;
366
+ }
367
+ if (noBuild) {
368
+ console.log("Running in translation-only mode (--no-build)\n");
369
+ }
370
+ let opencodeDir;
371
+ try {
372
+ opencodeDir = getOpenCodeDir();
373
+ if (!opencodeDir) {
374
+ log(RED, "错误: 未找到 OpenCode 安装目录");
375
+ log(YELLOW, "\n请选择以下方式之一:");
376
+ log(YELLOW, " 1. 设置环境变量: export OPENCODE_SOURCE_DIR=/path/to/opencode");
377
+ log(YELLOW, " 2. 自动安装: opencode-cn-localize --install");
378
+ process.exit(1);
379
+ }
380
+ console.log(`OpenCode directory: ${opencodeDir}`);
381
+ }
382
+ catch (e) {
383
+ log(RED, `Error: ${e.message}`);
384
+ process.exit(1);
385
+ }
386
+ const currentVersion = getOpenCodeVersion(opencodeDir);
387
+ console.log(`OpenCode version: ${currentVersion}`);
388
+ const translationsDir = getTranslationsDir();
389
+ console.log(`Translations directory: ${translationsDir}\n`);
390
+ const moduleConfig = loadModuleConfig(translationsDir);
391
+ console.log(`Translation config version: ${moduleConfig.version}`);
392
+ if (currentVersion !== moduleConfig.version) {
393
+ log(YELLOW, `⚠ 版本不匹配!`);
394
+ log(YELLOW, ` OpenCode: ${currentVersion}`);
395
+ log(YELLOW, ` 翻译插件: ${moduleConfig.version}`);
396
+ log(YELLOW, ` 可能存在未翻译的内容\n`);
397
+ }
398
+ else {
399
+ log(GREEN, `✓ 版本匹配!OpenCode: ${currentVersion}\n`);
400
+ }
401
+ console.log("Applying translations...\n");
402
+ const stats = {
403
+ filesProcessed: 0,
404
+ filesSkipped: 0,
405
+ totalReplacements: 0,
406
+ errors: []
407
+ };
408
+ const processModule = (category, files) => {
409
+ console.log(`[${category}]`);
410
+ for (const file of files) {
411
+ const config = loadTranslationFile(translationsDir, file);
412
+ if (!config) {
413
+ stats.filesSkipped++;
414
+ continue;
415
+ }
416
+ const result = applyTranslation(opencodeDir, config);
417
+ if (result.skipped) {
418
+ console.log(` ⊘ ${result.file} (${result.reason})`);
419
+ stats.filesSkipped++;
420
+ }
421
+ else if (result.replacements > 0) {
422
+ console.log(` ✓ ${result.file} (${result.replacements} replacements)`);
423
+ stats.filesProcessed++;
424
+ stats.totalReplacements += result.replacements;
425
+ }
426
+ else {
427
+ console.log(` - ${result.file} (no matches)`);
428
+ stats.filesProcessed++;
429
+ }
430
+ }
431
+ console.log("");
432
+ };
433
+ const modules = moduleConfig.modules;
434
+ if (modules.root) {
435
+ processModule("root", modules.root);
436
+ }
437
+ if (modules.dialogs) {
438
+ processModule("dialogs", modules.dialogs);
439
+ }
440
+ if (modules.components) {
441
+ processModule("components", modules.components);
442
+ }
443
+ if (modules.routes) {
444
+ processModule("routes", modules.routes);
445
+ }
446
+ if (modules.common) {
447
+ processModule("common", modules.common);
448
+ }
449
+ console.log("==================================");
450
+ console.log(`Summary:`);
451
+ console.log(` Files processed: ${stats.filesProcessed}`);
452
+ console.log(` Files skipped: ${stats.filesSkipped}`);
453
+ console.log(` Total replacements: ${stats.totalReplacements}`);
454
+ console.log("\nLocalization complete!");
455
+ if (!noBuild) {
456
+ try {
457
+ await buildOpenCode(opencodeDir);
458
+ console.log("\n🎉 OpenCode 中文版已准备就绪!");
459
+ console.log(" 启动命令: opencode");
460
+ }
461
+ catch (error) {
462
+ console.error("\n构建失败,但翻译已完成。您可以手动运行构建命令:");
463
+ console.error(` cd ${path_1.default.join(opencodeDir, "packages", "opencode")} && bun run build`);
464
+ process.exit(1);
465
+ }
466
+ }
467
+ }
468
+ main();
469
+ //# sourceMappingURL=localize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localize.js","sourceRoot":"","sources":["../localize.ts"],"names":[],"mappings":";;;;;AAAA,4CAAmB;AACnB,gDAAuB;AACvB,4CAAmB;AACnB,iDAA+C;AAuB/C,MAAM,IAAI,GAAG,UAAU,CAAA;AACvB,MAAM,KAAK,GAAG,UAAU,CAAA;AACxB,MAAM,MAAM,GAAG,UAAU,CAAA;AACzB,MAAM,GAAG,GAAG,UAAU,CAAA;AACtB,MAAM,EAAE,GAAG,SAAS,CAAA;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AC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;IACzC,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,oCAAoC,CAAC,CAAA;IACjD,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACvB,OAAO,CAAC,GAAG,CAAC,sBAAsB,KAAK,CAAC,cAAc,EAAE,CAAC,CAAA;IACzD,OAAO,CAAC,GAAG,CAAC,oBAAoB,KAAK,CAAC,YAAY,EAAE,CAAC,CAAA;IACrD,OAAO,CAAC,GAAG,CAAC,yBAAyB,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAA;IAC/D,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA;IAEvC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,IAAI,CAAC;YACH,MAAM,aAAa,CAAC,WAAW,CAAC,CAAA;YAChC,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAA;YACtC,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAA;QAClC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAA;YAC3C,OAAO,CAAC,KAAK,CAAC,QAAQ,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAA;YACxF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,CAAC;IACH,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAA"}
package/package.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "opencode-cn",
3
+ "version": "1.2.10",
4
+ "description": "OpenCode 中文翻译插件 - OpenCode Chinese Localization Plugin",
5
+ "main": "dist/localize.js",
6
+ "bin": {
7
+ "opencode-cn-localize": "dist/localize.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsc",
11
+ "localize": "bun run localize.ts",
12
+ "prepublishOnly": "npm run build"
13
+ },
14
+ "keywords": [
15
+ "opencode",
16
+ "chinese",
17
+ "localization",
18
+ "i18n",
19
+ "ai",
20
+ "coding",
21
+ "assistant",
22
+ "cli",
23
+ "tui"
24
+ ],
25
+ "author": "opencode-cn",
26
+ "license": "MIT",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/huangzejian365/opencode-cn"
30
+ },
31
+ "homepage": "https://github.com/huangzejian365/opencode-cn#readme",
32
+ "bugs": {
33
+ "url": "https://github.com/huangzejian365/opencode-cn/issues"
34
+ },
35
+ "engines": {
36
+ "node": ">=18.0.0"
37
+ },
38
+ "publishConfig": {
39
+ "access": "public",
40
+ "registry": "https://registry.npmjs.org/"
41
+ },
42
+ "files": [
43
+ "dist/",
44
+ "translations/",
45
+ "README.md"
46
+ ],
47
+ "devDependencies": {
48
+ "@types/node": "^25.3.0",
49
+ "typescript": "^5.9.3"
50
+ },
51
+ "os": [
52
+ "linux",
53
+ "darwin",
54
+ "win32"
55
+ ]
56
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/app.tsx",
3
+ "description": "应用主入口 - 命令和系统设置",
4
+ "replacements": {
5
+ "title: \"Switch session\"": "title: \"切换会话\"",
6
+ "title: \"New session\"": "title: \"新建会话\"",
7
+ "title: \"Switch model\"": "title: \"切换模型\"",
8
+ "title: \"Model cycle\"": "title: \"模型切换\"",
9
+ "title: \"Model cycle reverse\"": "title: \"模型切换(反向)\"",
10
+ "title: \"Favorite cycle\"": "title: \"收藏切换\"",
11
+ "title: \"Favorite cycle reverse\"": "title: \"收藏切换(反向)\"",
12
+ "title: \"Switch agent\"": "title: \"切换代理\"",
13
+ "title: \"Toggle MCPs\"": "title: \"切换MCP\"",
14
+ "title: \"Agent cycle\"": "title: \"代理切换\"",
15
+ "title: \"Agent cycle reverse\"": "title: \"代理切换(反向)\"",
16
+ "title: \"Variant cycle\"": "title: \"变体切换\"",
17
+ "title: \"Connect provider\"": "title: \"连接提供商\"",
18
+ "title: \"View status\"": "title: \"查看状态\"",
19
+ "title: \"Switch theme\"": "title: \"切换主题\"",
20
+ "title: \"Toggle appearance\"": "title: \"切换外观\"",
21
+ "title: \"Help\"": "title: \"帮助\"",
22
+ "title: \"Open docs\"": "title: \"打开文档\"",
23
+ "title: \"Exit the app\"": "title: \"退出应用\"",
24
+ "title: \"Toggle debug panel\"": "title: \"切换调试面板\"",
25
+ "title: \"Toggle console\"": "title: \"切换控制台\"",
26
+ "title: \"Write heap snapshot\"": "title: \"写入堆快照\"",
27
+ "title: \"Suspend terminal\"": "title: \"挂起终端\"",
28
+ "title: \"Disable terminal title\"": "title: \"禁用终端标题\"",
29
+ "title: \"Enable terminal title\"": "title: \"启用终端标题\"",
30
+ "title: \"Disable animations\"": "title: \"禁用动画\"",
31
+ "title: \"Enable animations\"": "title: \"启用动画\"",
32
+ "title: \"Disable diff wrapping\"": "title: \"禁用差异换行\"",
33
+ "title: \"Enable diff wrapping\"": "title: \"启用差异换行\"",
34
+ "message: \"Copied to clipboard\"": "message: \"已复制到剪贴板\"",
35
+ "message: \"Failed to fork session\"": "message: \"无法分叉会话\"",
36
+ "message: \"The current session was deleted\"": "message: \"当前会话已删除\"",
37
+ "message: \"An error occurred\"": "message: \"发生错误\"",
38
+ "title: \"Update Available\"": "title: \"有更新可用\"",
39
+ "message: \"Successfully copied\"": "message: \"复制成功\"",
40
+ "message: \"Reset TUI\"": "message: \"重置TUI\"",
41
+ "message: \"Exit\"": "message: \"退出\"",
42
+ "message: \"A fatal error occurred!\"": "message: \"发生致命错误!\"",
43
+ "message: \"Please report an issue.\"": "message: \"请报告问题。\"",
44
+ "message: \"Copy issue URL (exception info pre-filled)\"": "message: \"复制问题URL(异常信息已预填)\""
45
+ }
46
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "description": "通用应用消息 - 这些翻译已整合到各组件文件中",
3
+ "replacements": {}
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "description": "错误消息 - 这些翻译已整合到各组件文件中",
3
+ "replacements": {}
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "description": "Toast消息 - 这些翻译已整合到各组件文件中",
3
+ "replacements": {}
4
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/component/prompt/autocomplete.tsx",
3
+ "description": "自动完成组件",
4
+ "replacements": {
5
+ "<text fg={theme.textMuted}>No matching items</text>": "<text fg={theme.textMuted}>无匹配项</text>"
6
+ }
7
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/component/prompt/index.tsx",
3
+ "description": "提示输入组件",
4
+ "replacements": {
5
+ "title: \"Clear prompt\"": "title: \"清空提示\"",
6
+ "title: \"Submit prompt\"": "title: \"提交提示\"",
7
+ "title: \"Paste\"": "title: \"粘贴\"",
8
+ "title: \"Interrupt session\"": "title: \"中断会话\"",
9
+ "title: \"Open editor\"": "title: \"打开编辑器\"",
10
+ "title: \"Skills\"": "title: \"技能\"",
11
+ "title: \"Stash prompt\"": "title: \"暂存提示\"",
12
+ "title: \"Stash pop\"": "title: \"弹出暂存\"",
13
+ "title: \"Stash list\"": "title: \"暂存列表\"",
14
+ "message: \"Connect a provider to send prompts\"": "message: \"连接提供商以发送提示\"",
15
+ "return `Ask anything...": "return `询问任何问题...",
16
+ "return `Run a command...": "return `运行命令...",
17
+ "\"interrupt\"": "\"中断\"",
18
+ "\"again to interrupt\"": "\"再次中断\"",
19
+ "\"exit shell mode\"": "\"退出终端模式\"",
20
+ "\"gemini is way too hot right now\"": "\"Gemini现在太火爆了\"",
21
+ "\" (click to expand)\"": "\" (点击展开)\""
22
+ }
23
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/component/tips.tsx",
3
+ "description": "提示信息组件",
4
+ "replacements": {
5
+ ">● Tip </text>": ">● 提示 </text>"
6
+ }
7
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "opencode-zh",
3
+ "version": "1.2.10",
4
+ "description": "OpenCode 中文汉化配置文件(模块化结构)",
5
+ "lastUpdate": "2026-02-23",
6
+ "upstream": {
7
+ "repo": "anomalyco/opencode",
8
+ "url": "https://github.com/anomalyco/opencode"
9
+ },
10
+ "modules": {
11
+ "dialogs": [
12
+ "dialogs/dialog-provider.json",
13
+ "dialogs/dialog-status.json",
14
+ "dialogs/dialog-model.json",
15
+ "dialogs/dialog-agent.json",
16
+ "dialogs/dialog-mcp.json"
17
+ ],
18
+ "components": [
19
+ "components/component-prompt.json",
20
+ "components/component-tips.json",
21
+ "components/autocomplete.json"
22
+ ],
23
+ "routes": [
24
+ "routes/route-sidebar.json",
25
+ "routes/route-permission.json"
26
+ ],
27
+ "common": [
28
+ "common/app-messages.json",
29
+ "common/error-messages.json",
30
+ "common/toast-messages.json"
31
+ ],
32
+ "root": [
33
+ "app.json"
34
+ ]
35
+ }
36
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/component/dialog-agent.tsx",
3
+ "description": "代理选择对话框",
4
+ "replacements": {
5
+ "title=\"Select agent\"": "title=\"选择代理\""
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/component/dialog-mcp.tsx",
3
+ "description": "MCP服务器管理对话框",
4
+ "replacements": {
5
+ "title=\"MCPs\"": "title=\"MCP服务器\"",
6
+ "title: \"toggle\"": "title: \"切换\"",
7
+ ">⋯ Loading</span>": ">⋯ 加载中</span>",
8
+ ">✓ Enabled</span>": ">✓ 已启用</span>",
9
+ ">○ Disabled</span>": ">○ 已禁用</span>"
10
+ }
11
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/component/dialog-model.tsx",
3
+ "description": "模型选择对话框",
4
+ "replacements": {
5
+ "title=\"Select model\"": "title=\"选择模型\"",
6
+ "title: \"Connect provider\"": "title: \"连接提供商\"",
7
+ "title: \"View all providers\"": "title: \"查看所有提供商\"",
8
+ "title: \"Favorite\"": "title: \"收藏\"",
9
+ "category: \"Favorites\"": "category: \"收藏\"",
10
+ "category: \"Recent\"": "category: \"最近使用\"",
11
+ "category: \"Popular providers\"": "category: \"热门提供商\"",
12
+ "(Favorite)": "(已收藏)",
13
+ "footer: \"Free\"": "footer: \"免费\""
14
+ }
15
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/component/dialog-provider.tsx",
3
+ "description": "提供商连接对话框",
4
+ "replacements": {
5
+ "title=\"Select auth method\"": "title=\"选择认证方式\"",
6
+ "title=\"Connect a provider\"": "title=\"连接提供商\"",
7
+ "placeholder=\"Authorization code\"": "placeholder=\"授权码\"",
8
+ "placeholder=\"API key\"": "placeholder=\"API密钥\"",
9
+ "label: \"API key\"": "label: \"API密钥\"",
10
+ "(Recommended)": "(推荐)",
11
+ "(Claude Max or API key)": "(Claude Max 或 API密钥)",
12
+ "(ChatGPT Plus/Pro or API key)": "(ChatGPT Plus/Pro 或 API密钥)",
13
+ "? \"Popular\" : \"Other\"": "? \"热门\" : \"其他\"",
14
+ "<text fg={theme.textMuted}>Waiting for authorization...</text>": "<text fg={theme.textMuted}>等待授权...</text>",
15
+ "<text fg={theme.error}>Invalid code</text>": "<text fg={theme.error}>无效的授权码</text>",
16
+ "c <span style={{ fg: theme.textMuted }}>copy</span>": "c <span style={{ fg: theme.textMuted }}>复制</span>",
17
+ "OpenCode Zen gives you access to all the best coding models at the cheapest prices with a single API key.": "OpenCode Zen 以最低的价格为您提供所有最佳编码模型的访问权限,只需一个 API 密钥。",
18
+ "Go to <span style={{ fg: theme.primary }}>https://opencode.ai/zen</span> to get a key": "前往 <span style={{ fg: theme.primary }}>https://opencode.ai/zen</span> 获取密钥",
19
+ "message: \"Copied to clipboard\"": "message: \"已复制到剪贴板\""
20
+ }
21
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/component/dialog-status.tsx",
3
+ "description": "状态对话框",
4
+ "replacements": {
5
+ ">Status</text>": ">状态</text>",
6
+ "<text fg={theme.text}>No MCP Servers</text>": "<text fg={theme.text}>无MCP服务器</text>",
7
+ "<text fg={theme.text}>No Formatters</text>": "<text fg={theme.text}>无格式化器</text>",
8
+ "<text fg={theme.text}>No Plugins</text>": "<text fg={theme.text}>无插件</text>",
9
+ " MCP Servers</text>": " 个MCP服务器</text>",
10
+ " Formatters</text>": " 个格式化器</text>",
11
+ " Plugins</text>": " 个插件</text>",
12
+ " LSP Servers</text>": " 个LSP服务器</text>",
13
+ ">Connected</Match>": ">已连接</Match>",
14
+ ">Disabled in configuration</Match>": ">配置中已禁用</Match>",
15
+ "Needs authentication (run: opencode mcp auth {key})": "需要认证(运行: opencode mcp auth {key})"
16
+ }
17
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/routes/session/permission.tsx",
3
+ "description": "权限请求组件",
4
+ "replacements": {
5
+ "title=\"Permission required\"": "title=\"需要权限\"",
6
+ "title=\"Always allow\"": "title=\"始终允许\"",
7
+ "title=\"Reject permission\"": "title=\"拒绝权限\"",
8
+ "options={{ once: \"Allow once\", always: \"Allow always\", reject: \"Reject\" }}": "options={{ once: \"允许一次\", always: \"始终允许\", reject: \"拒绝\" }}",
9
+ "options={{ confirm: \"Confirm\", cancel: \"Cancel\" }}": "options={{ confirm: \"确认\", cancel: \"取消\" }}",
10
+ ">Permission required</text>": ">需要权限</text>",
11
+ ">Reject permission</text>": ">拒绝权限</text>",
12
+ ">Tell OpenCode what to do differently</text>": ">告诉OpenCode该怎么做</text>",
13
+ "This will allow": "这将允许",
14
+ "until OpenCode is restarted": "直到OpenCode重启",
15
+ "This will allow the following patterns until OpenCode is restarted": "这将允许以下模式直到OpenCode重启",
16
+ ">Continue after repeated failures</text>": ">多次失败后继续</text>",
17
+ "Access external directory": "访问外部目录",
18
+ "Call tool": "调用工具"
19
+ }
20
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "file": "src/cli/cmd/tui/routes/session/sidebar.tsx",
3
+ "description": "侧边栏组件",
4
+ "replacements": {
5
+ ">Context</text>": ">上下文</text>",
6
+ " tokens</text>": " 令牌</text>",
7
+ "% used</text>": "% 已使用</text>",
8
+ " spent</text>": " 已花费</text>",
9
+ ">MCP</text>": ">MCP</text>",
10
+ " active</span>": " 活跃</span>",
11
+ " error</span>": " 错误</span>",
12
+ " errors</span>": " 错误</span>"
13
+ }
14
+ }