Agent Skillswalterlow/freecut › translate-app-locales

translate-app-locales

GitHub

用于全栈应用多语言支持,包括添加新语言、审计翻译覆盖率、修复不完整译文及移除英文回退。涵盖注册语言、创建基础JSON、同步部分命名空间及验证键值完整性。

.codex/skills/translate-app-locales/SKILL.md walterlow/freecut

触发场景

添加新语言 修复不完整翻译 移除英文回退 验证语言覆盖度

安装

npx skills add walterlow/freecut --skill translate-app-locales -g -y
更多选项

非标准路径

npx skills add https://github.com/walterlow/freecut/tree/main/.codex/skills/translate-app-locales -g -y

不安装直接使用

npx skills use walterlow/freecut@translate-app-locales

指定 Agent (Claude Code)

npx skills add walterlow/freecut --skill translate-app-locales -a claude-code -g -y

安装 repo 全部 skill

npx skills add walterlow/freecut --all -g -y

预览 repo 内 skill

npx skills add walterlow/freecut --list

SKILL.md

Frontmatter
{
    "name": "translate-app-locales",
    "description": "Add or audit full application translations across base locale files and partial i18n namespaces. Use when the user asks to add a new language, fix incomplete translations, remove English fallbacks, verify locale coverage, move language UI, or make future app sections translated in React\/TypeScript apps with JSON locale files, especially FreeCut-style src\/i18n\/locales plus src\/i18n\/locales\/partials structures."
}

Translate App Locales

Workflow

Use this skill for end-to-end language work, not just a single JSON file.

  1. Locate the i18n entrypoint, supported language registry, base locale files, and partial namespace files.
  2. Add the language to the registry and import/load it wherever base locales are wired.
  3. Create the base locale JSON for the language.
  4. Translate every partial namespace that has English keys, including catch-all or "missing" files.
  5. Preserve the English key tree exactly for the target language.
  6. Preserve interpolation tokens, ICU/plural suffixes, HTML tags, component placeholders, URLs, command names, and code identifiers.
  7. Remove obsolete UI settings only when the user asked for product behavior changes, not as part of translation by default.
  8. Validate JSON parsing, key coverage, and the app build or relevant tests.

FreeCut Locale Map

For FreeCut-like repos, check all of these:

  • src/i18n/languages.ts: SUPPORTED_LANGUAGES, direction, native name, English name.
  • src/i18n/index.ts: base locale imports and baseLocales.
  • src/i18n/locales/<lang>.json: base app shell/settings/common language strings.
  • src/i18n/locales/partials/*.json: every namespace partial. Do not skip missing.json; it may contain active export/media/preview/timeline UI.
  • Existing locale files: remove keys only when the source UI no longer uses them.

If the repo has a different structure, adapt the same rule: target language must cover every English leaf key that can be loaded by i18next or the app's locale loader.

Translation Rules

  • Translate user-facing prose naturally in the target language.
  • Keep product names such as FreeCut unchanged unless the existing locale pattern translates them.
  • Keep placeholders byte-for-byte: {{count}}, {{name}}, <code>, <strong>, <link>, <accent>, and similar markers.
  • Keep plural variants as separate keys: _one, _other, etc.
  • Keep technical acronyms when normal in the target language: FPS, GPU, URL, MP4, AAC.
  • Prefer concise UI labels over literal long translations when button space is tight.
  • For language toolbar chips, use two-letter uppercase base codes such as EN, ZH, FR, TR unless the product has a different standard.
  • Preserve valid UTF-8. Non-ASCII is expected in translated locale files.

Coverage Validation

Use the bundled script after editing locale files:

node <skill>/scripts/check-locale-coverage.mjs --locales src/i18n/locales --partials src/i18n/locales/partials --source en --target tr

The script verifies:

  • JSON parses for base and partial locale files.
  • The target base locale has all source base leaf keys.
  • Each partial's target language has every source language leaf key.

If the project has no partial directory, omit --partials.

Verification

Run the repo's fastest meaningful checks:

  • Locale coverage script for the target language.
  • JSON parse validation if the project has custom locale loading.
  • Focused tests for settings/language persistence when language controls changed.
  • Build/typecheck when translations touch app wiring or TypeScript imports.

Report unrelated failures clearly and do not hide them as translation failures.

版本历史

  • 4d62e80 当前 2026-08-20 08:45

同 Skill 集合

.claude/skills/changelog/SKILL.md

元信息

文件数
0
版本
4d62e80
Hash
479c4df5
收录时间
2026-08-20 08:45

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-21 08:00
浙ICP备14020137号-1