Internationalization (i18n) (Deep Workflow)
i18n is engineering readiness for multiple languages: extractable strings, ICU messages, locale-aware formatting, and tests—before full localization (translator workflow).
When to Offer This Workflow
Trigger conditions:
- - Planning first non-English locales
- Hard-coded UI strings across the codebase
- Incorrect date/number formatting outside default locale
Initial offer:
Use six stages: (1) inventory & scope, (2) extraction pipeline, (3) ICU & placeholders, (4) formatting APIs, (5) layout & overflow, (6) QA hooks). Confirm framework (i18next, FormatJS, rails-i18n, etc.).
Stage 1: Inventory & Scope
Goal: Which surfaces ship first; pilot locales; avoid translating everything on day one.
Stage 2: Extraction Pipeline
Goal: Stable message keys; CI lint to block new user-visible literals where policy requires; namespaces per feature.
Stage 3: ICU & Placeholders
Goal: Plural and select rules; named variables; no string concatenation across translated fragments.
Stage 4: Formatting APIs
Goal: Intl (or platform equivalent) for dates, numbers, currency; explicit timezone policy (UTC vs user local).
Stage 5: Layout & Overflow
Goal: Flexible layouts for longer translations; pseudolocale in CI to catch truncation (e.g., xx-ACME).
Stage 6: QA Hooks
Goal: Easy locale switching in staging; optional screenshot/visual tests for critical screens.
Final Review Checklist
- - [ ] Scope and pilot locales defined
- [ ] Extraction and linting in place
- [ ] ICU for plurals; no unsafe concatenation
- [ ] Intl formatting for numbers/dates
- [ ] Pseudolocale or stress language in QA
Tips for Effective Guidance
- - Pair with localization skill for translator workflow and TMS integration.
Handling Deviations
- - Games or marketing-heavy UIs: context comments for translators are critical.
国际化(i18n)(深度工作流)
i18n 是针对多语言的工程就绪:可提取字符串、ICU 消息、区域感知格式化及测试——在完整的本地化(翻译工作流)之前。
何时提供此工作流
触发条件:
- - 计划首个非英语区域
- 代码库中存在硬编码的 UI 字符串
- 默认区域以外的日期/数字格式不正确
初始提供:
使用六个阶段:(1)盘点与范围,(2)提取管道,(3)ICU 与占位符,(4)格式化 API,(5)布局与溢出,(6)QA 钩子。确认框架(i18next、FormatJS、rails-i18n 等)。
阶段 1:盘点与范围
目标: 确定首批上线的界面;试点区域;避免第一天就翻译所有内容。
阶段 2:提取管道
目标: 稳定的消息键;CI 检查以阻止策略要求下新的用户可见字面量;按功能划分命名空间。
阶段 3:ICU 与占位符
目标: 复数与选择规则;命名变量;避免跨翻译片段进行字符串拼接。
阶段 4:格式化 API
目标: 使用 Intl(或平台等效方案)处理日期、数字、货币;明确时区策略(UTC 与用户本地时间)。
阶段 5:布局与溢出
目标: 为较长翻译提供灵活布局;在 CI 中使用伪区域检测截断问题(例如 xx-ACME)。
阶段 6:QA 钩子
目标: 在预发布环境中轻松切换区域;对关键屏幕进行可选的截图/视觉测试。
最终审查清单
- - [ ] 已定义范围与试点区域
- [ ] 已建立提取与检查机制
- [ ] 已使用 ICU 处理复数;无危险拼接
- [ ] 已使用 Intl 格式化数字/日期
- [ ] 已在 QA 中使用伪区域或压力语言
有效指导技巧
- - 与本地化技能配合使用,处理翻译工作流和 TMS 集成。
处理偏差
- - 游戏或营销密集型 UI:为翻译人员提供上下文注释至关重要。