@electerm/electerm-locales
v2.1.58
Published
electerm multi-language support pack
Downloads
12,090
Readme
electerm-locales
English | 简体中文
electerm 多语言支持包。
🇺🇸 🇨🇳 🇧🇷 🇷🇺 🇪🇸 🇫🇷 🇹🇷 🇯🇵 🇰🇷 🇹🇼 🇩🇪 🇮🇩
开发
git clone git://github.com/electerm/electerm-locales.git
cd electerm-locales
npm i
cp config.sample.js config.js
npm start
# 自动同步 locales/* 到 ../electerm/node_modules/electerm-locales/locales/ 以便测试
# 并添加 pre-push 钩子,在每次推送前执行 lint 和 test测试
npm run test
# 测试只是确保所有语言文件的键和顺序匹配贡献
只需使用 locales/en_us.js 作为示例,fork 此仓库,添加你的编辑,然后提交 pull request。
确保在推送前运行 npm run test。
创建新语言文件的脚本
为了让工作更轻松,我创建了一个脚本来帮助创建语言文件,它使用 AI API 翻译所有条目并创建新的语言文件。
# 从 siliconflow.cn 或 deepseek.com 获取 apiKey
# lang={语言代码} url="{api 地址}" model="{模型名称}" apiKey={apiKey} node bin/create-new-language-file-with-ai.js
# 然后它会在 locales 文件夹中创建 {语言代码}_{语言代码}.js
# 例如:
# 这将创建德语语言文件 `locales/de_de.js`
lang=de url='https://api.siliconflow.cn/v1/chat/completions' model='deepseek-ai/DeepSeek-V2.5' apiKey=xxxx node bin/create-new-language-file-with-ai.js
# 然后你可以审查和编辑以确保每个条目都正确使用 AI API 添加新条目
你当然可以逐个翻译,我也提供了一个脚本来完成它。
# entry="{一级条目名称}" name="{属性名称}" text="{原始语言的文本}" url="{api 地址}" model="{模型名称}" apiKey={apiKey} node bin/translate-with-ai.js
# 示例:
entry=setting name=saveTerminalLogToFile text="save terminal log to file" url='https://api.siliconflow.cn/v1/chat/completions' model='deepseek-ai/DeepSeek-V2.5' apiKey=xxxx node bin/translate-with-ai.js
# 然后它会使用 AI 翻译将 saveTerminalLogToFile 条目添加到 setting 命名空间下的所有语言文件中
## 从所有文件中删除条目
entry=setting name=disableSshHistory node bin/remove-slot.js
更新所有文件中的现有条目
要更新所有语言文件中现有条目的值(针对给定的命名空间和键),请使用提供的脚本:
# entry="{命名空间}" name="{键}" data='{"en":"new English text", "zh-CN":"新的中文", ...}' node bin/update-entry.js
# 示例:更新 "setting" 命名空间下键 "saveTerminalLogToFile" 的值
entry=setting name=saveTerminalLogToFile data='{"en":"Save terminal log to file (updated)", "zh-CN":"保存终端日志到文件(已更新)"}' node bin/update-entry.js
# 仅限更新特定语言(例如,仅英语和中文):
entry=setting name=saveTerminalLogToFile to="en,zh-CN" data='{"en":"Save terminal log to file (updated)", "zh-CN":"保存终端日志到文件(已更新)"}' node bin/update-entry.js如果键在任何文件中不存在,脚本将抛出错误。
使用代理
cp sample.env .env
# 然后编辑 .env,添加 socks 代理支持的语言和创建者
- 🇺🇸 English: @zxdong262
- 🇨🇳 简体中文: @zxdong262
- 🇧🇷 Português do Brasil: @Meirinaldo Júnior
- 🇷🇺 русский: @Vasiliy
- 🇪🇸 Español: Federico Pereira [email protected]
- 🇫🇷 Français: @Damien Mosse
- 🇹🇷 Türkçe: @Nazım Gediz Aydınoğmuş
- 🇹🇼 繁體中文: @ycku
- 🇯🇵 日本語: @hououinkami
- 🇰🇷 한국어: @jooy2
- 🇩🇪 german: @Hope-IT-Works
- 🇮🇩 Bahasa Indonesia: @hazekezia
- 🇵🇱 Polski: @milocha
贡献者
https://github.com/electerm/electerm-locales/graphs/contributors
