polished-localization-for-claude-code 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +529 -0
- package/bin/install.js +813 -0
- package/bin/restore.js +39 -0
- package/localize/keyword.js +624 -0
- package/localize/localize.js +176 -0
- package/package.json +57 -0
- package/tool-tips-post.sh +382 -0
package/bin/restore.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { execSync } = require('child_process');
|
|
6
|
+
const pkg = require('../package.json');
|
|
7
|
+
|
|
8
|
+
const MAGENTA = '\x1b[38;5;206m';
|
|
9
|
+
const GREEN = '\x1b[0;32m';
|
|
10
|
+
const YELLOW = '\x1b[0;33m';
|
|
11
|
+
const RED = '\x1b[0;31m';
|
|
12
|
+
const NC = '\x1b[0m';
|
|
13
|
+
|
|
14
|
+
console.log(`\n${MAGENTA}${pkg.name} 正在恢复 Claude Code 英文界面...${NC}\n`);
|
|
15
|
+
|
|
16
|
+
const pkgName = '@anthropic-ai/claude-code';
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const log = execSync(`npm list -g ${pkgName} --depth=0`, { encoding: 'utf8' });
|
|
20
|
+
if (!log.trim().includes(pkgName)) {
|
|
21
|
+
console.log(`${RED}未找到 Claude Code${NC}`);
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
|
|
26
|
+
const cliPath = path.join(npmRoot, pkgName, 'cli.js');
|
|
27
|
+
const cliBak = path.join(npmRoot, pkgName, 'cli.bak.js');
|
|
28
|
+
|
|
29
|
+
if (fs.existsSync(cliBak)) {
|
|
30
|
+
fs.copyFileSync(cliBak, cliPath);
|
|
31
|
+
console.log(`${GREEN}已恢复为英文界面${NC}`);
|
|
32
|
+
} else {
|
|
33
|
+
console.log(`${YELLOW}未找到备份文件,可能已经是英文版${NC}`);
|
|
34
|
+
}
|
|
35
|
+
} catch (err) {
|
|
36
|
+
console.log(`${RED}恢复失败: ${err.message}${NC}`);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log(`\n${MAGENTA}请重启 Claude Code 使更改生效${NC}\n`);
|