Agent Skills › rokartur/BetterCmdTab › localize-strings

localize-strings

GitHub

管理 macOS 应用本地化字符串,确保代码与 Localizable.xcstrings/InfoPlist.xcstrings 同步,支持七种语言翻译及格式符一致性验证。

.agents/skills/localize-strings/SKILL.md rokartur/BetterCmdTab

触发场景

新增或修改用户可见字符串 更新 Info.plist 使用说明 本地化测试失败

安装

npx skills add rokartur/BetterCmdTab --skill localize-strings -g -y
更多选项

非标准路径

npx skills add https://github.com/rokartur/BetterCmdTab/tree/main/.agents/skills/localize-strings -g -y

不安装直接使用

npx skills use rokartur/BetterCmdTab@localize-strings

指定 Agent (Claude Code)

npx skills add rokartur/BetterCmdTab --skill localize-strings -a claude-code -g -y

安装 repo 全部 skill

npx skills add rokartur/BetterCmdTab --all -g -y

预览 repo 内 skill

npx skills add rokartur/BetterCmdTab --list

SKILL.md

Frontmatter
{
    "name": "localize-strings",
    "description": "Keep the string catalogs (Localizable.xcstrings, InfoPlist.xcstrings) in lockstep with the code. Use whenever code adds, edits, or removes any user-facing string or Info.plist usage description, or when LocalizationCatalogTests fails."
}

Localize strings

Every user-facing string ships translated in seven locales. The catalog is version-controlled JSON and LocalizationCatalogTests pins full coverage — an English-only key fails the suite, it does not silently ship.

1. Use the localized form in code

User-facing text is String(localized: "…"); enum display names localize too. A bare literal in UI code ships untranslated — wrap it.

2. Add the catalog entries

Edit BetterCmdTab/Localizable.xcstrings directly (it is JSON). For each new key add translations for all of: de, es, fr, ja, pl, ru, zh-Hans. Copy the exact JSON shape of a neighboring entry, keep keys sorted where the surrounding file is sorted, and keep format specifiers (%@, %d, …) identical across every locale — specifier drift is a test failure. Remove catalog entries whose code key was deleted.

Info.plist strings live in BetterCmdTab/InfoPlist.xcstrings and the same suite covers them, with two extra rules.

Key a usage description by its plist key name (NSAppleEventsUsageDescription), not by its English value — the value form compiles fine and never resolves at runtime. Document-type names (CFBundleTypeName, UTTypeDescription) are the exception: those are keyed by value.

Every key in this catalog also needs an explicit en entry. A key-named one has no other source of English: without it Xcode emits the key as its own value and the prompt reads NSAppleEventsUsageDescription. For a value-keyed one it is redundant, but the test requires it uniformly.

Keep that en value byte-identical to its source — the INFOPLIST_KEY_* build setting in project.pbxproj (both configurations) for key-named entries, BetterCmdTab/Info.plist for document-type names. en.lproj/InfoPlist.strings overrides Info.plist, so editing only the build setting changes nothing.

3. Verify

xcodebuild -scheme "BetterCmdTab Debug" -destination 'platform=macOS' test \
  -only-testing:BetterCmdTabTests/LocalizationCatalogTests

Complete when: the suite passes with the new keys present in all seven locales.

版本历史

  • 786e953 当前 2026-11-02 12:03

    增加日语(ja)本地化支持,将目标语言从6种扩展至7种。

  • 1168eb6 2026-09-27 13:34

    新增俄语(ru)支持;将 InfoPlist.xcstrings 纳入本地化测试覆盖范围;修复自动化提示词键名错误,确保运行时正确解析。

  • 30e25b6 2026-07-30 22:00

同 Skill 集合

.agents/skills/add-preference/SKILL.md
.agents/skills/babysit-pr/SKILL.md
.agents/skills/dock-tile-icon/SKILL.md
.agents/skills/marketing-screenshots/SKILL.md
.agents/skills/release-changelog/SKILL.md
.agents/skills/release/SKILL.md
.agents/skills/verify/SKILL.md

元信息

文件数
0
版本
786e953
Hash
95415f20
收录时间
2026-07-30 22:00

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.156.0. UTC+08:00, 2026-11-05 11:12
浙ICP备14020137号-1