Repository navigation
feat(i18n): add Spanish (Español) interface language - #93
Open
yosoymitxel wants to merge 5 commits into
Open
yosoymitxel wants to merge 5 commits into
yosoymitxel wants to merge 5 commits into
Conversation
- 新增 src/i18n:以中文原文作为翻译 key(gettext 风格),主进程与渲染进程共用; en.json / vi.json 共 1101 条(含 MuMu / FydeOS 底座、横屏、独立窗口、按键映射、 系统语言 / 中文输入法、开机动画等文案) - 渲染层 src/ui/i18n-dom.js:静态 HTML 文本、title/placeholder 及 [data-i18n-html] 片段按当前语言替换;主窗口、应用窗口、开机动画均接入 - app.js / main.js / core/*(含 core/backends/*、keymap 预设)中用户可见的提示、托盘菜单、 对话框、进度与错误信息统一走 t();仅写日志的字符串保持中文 - 设置新增「界面语言」,标题栏新增地球图标语言切换按钮;切换后托盘重建、窗口 reload - settings.language 默认 'en' - tools/check-i18n.js(npm run check:i18n):检查缺失翻译、占位符不一致与未包裹的中文字符串 - 单元测试固定使用 zh,断言仍基于中文原文 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
语言选择与持久化 - settings.language 默认改为空;启动时 resolveInitialLanguage 只决定一次并写回: 已有设置/应用清单的老用户升级后保持中文,新用户跟随系统语言(不支持的回落英文) - 缺失译文按 vi → en → 中文原文回退;空译文视为缺失 - setLanguage 拒绝不支持的代码(不再静默映射成英文) - 切换语言:主窗口 / 开机动画 reload;应用窗口外壳(内嵌运行中的安卓画面)不 reload, 收到 i18n:changed 后就地重译,正在运行的应用与运行时不受影响 逻辑不依赖译文 - 安装失败界面提示按 err.code / 未翻译的原始标记(INSTALL_FAILED_*、ENOSPC)判断, 去掉对中/英/越译文句子的正则匹配;install:error 事件带上 code - 磁盘不足(provision)抛 DISK_FULL;emulator 返回 code: 'DISK_FULL' - 写进运行日志(供 doctor.diagnose 正则分析)的退出码含义与磁盘检查固定为原文, 不随界面语言变化 - 源限流改用 HTTP 状态码字段(limited / status),不解析错误文本 插值安全 - 新增 tHtml():词典模板中的标记可信,插值一律 HTML 转义;欢迎卡改用 tHtml - 应用卡片里未转义的 t() 输出补上 esc(),补译漏掉的「拖入 APK 即可安装」 检查与测试 - tools/check-i18n.js:en ⇔ vi key 一致、占位符与 HTML 标签一致、空译文;识别 tHtml / N_ - test/i18n-test.js(并入 npm test):语言选择、升级/新装/重启持久化(每个场景独立 APPDATA)、 回退链、转义、词典一致性、错误码在各语言下保留 - test/ui-i18n-layout.js(npm run test:ui-i18n):真实 Electron 渲染、IPC mock, zh/en/vi × 默认/最小窗口 × 100/150/200% 缩放,检测文字裁切、按钮文字溢出、横向滚动条, 并验证应用窗口外壳不 reload 即可切换语言 - test/i18n-app-smoke.js(npm run test:i18n-smoke):真实 app 进程、独立 APPDATA, 验证新装/升级/切换/重启后的语言与设置保持(不含安卓运行时) - CI:新增「多语言词典检查」步骤与 Electron 布局检查 job(截图作为 artifact) 布局修复(由布局测试发现,中文下不出现) - 设置里按钮行允许换行(英文 +53px / 越南文 +19px 横向溢出) - 按钮文字不折行(英/越译文在 28px 高按钮里折成两行溢出) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
冲突处理(以上游逻辑/文案为准,再套上 t()): - adb.js:保留 t 导入 + 上游平板密度(tabletDensity) - emulator.js:网络体检提示用上游新文案(不再建议重置数据) - provision.js:镜像说明含「包内压缩版」分支;playImageInfo 双目录查找 - store.js:existingUser 与 STORE_BUILD 并存 - main.js:横竖屏切换提示、商店版更新拦截、先收起管理窗口 - app.js / index.html:横竖屏策略 + 平板排版设置 上游新增的界面文案补上 t() 与 en / vi 翻译(39 条):开机动画「本地准备中」、 商店版 WHPX 提示、方向/平板排版 toast 与设置说明(adb 端口说明改为 data-i18n-html); splash-preload 改用与 preload 相同的语言解析并暴露 tHtml。 删除上游已不再使用的 10 条词典 key。 验证:npm test(9/25/117/18)、check:i18n(1132 key,缺失 0)、 test:ui-i18n(3 种缩放 × 30 项)、test:i18n-smoke(13/13)全部通过。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds src/i18n/es.json on top of the en/vi i18n layer from RoutineMiku#84 and registers `es` (fallback es -> en -> Chinese source, OS locales es-*). - 902 strings reuse the Spanish translations from RoutineMiku#72 (re-keyed to the {name} placeholder style used here); the remaining 235 strings that are new in 0.5.x were translated for this change. - check-i18n and the i18n tests now also cover `es` (key parity, placeholders, HTML tags); electron-builder keeps the `es` locale. Co-authored-by: RobiiAragon <RobiiAragon@users.noreply.github.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SPRH6Hf1Yry5K6S5QjRvEF
5 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Spanish (Español) as an interface language, on top of the en/vi i18n layer from #84.
What changes
src/i18n/es.json— 1137 strings, same key set asen.json/vi.json.src/i18n/index.js— registerses(nameEspañol, fallbackes → en → Chinese source, matches OS localeses-*).tools/check-i18n.js,test/i18n-test.js—esis covered by the same checks asen/vi(key parity, placeholders, HTML tags, no missing keys).electron-builder.yml— keeps theesElectron locale.Where the translations come from
{name}placeholder style used by feat(i18n): 界面多语言 English / Tiếng Việt / 中文 #84.This is meant to complement #72, not compete with it: it carries that work over to the i18n mechanism of #84 so both can land together.
Testing
node test/i18n-test.js→ 18 passednode tools/check-i18n.js→[es] keys=1132 missing=0 unused=5,dictionary problems=0node test/run-tests.js→ 9 passedtest:ui-i18n,test:i18n-smoke), so long Spanish strings have not been checked for overflow on screen.🤖 Generated with Claude Code
https://claude.ai/code/session_01SPRH6Hf1Yry5K6S5QjRvEF