国际化 (i18n) 开发指南。在添加新文本、创建物品/事件、修改翻译或管理 PO/MO 文件时使用。
65
78%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./.cursor/skills/i18n-development/SKILL.md将新条目追加到 static/locales/{lang}/modules/ 或 game_configs_modules/ 中相应的 .po 文件里。
格式要求:
msgid 必须是准确的英文字符串。msgstr 是翻译内容。msgid "Found {amount} spirit stone"
msgstr "发现了 {amount} 块灵石"如果正在开发新功能,请创建一个新的 .po 文件(例如,modules/new_feature.po)。
Project-Id-Version)。构建脚本会处理头部信息。直接开始编写 msgid 即可。仓库中的语言列表单一真相源位于 static/locales/registry.json。
zh-CN / zh-TW / en-US / vi-VN / ja-JP / fr-FR。.po 或 .csv 文件中的更改在编译为 .mo 文件之前 不会 在游戏中生效。
在任何翻译更改后,始终运行构建脚本:
python tools/i18n/build_mo.py>>) 追加内容到 PO 文件(这会导致 UTF-16LE 编码和 \x00 损坏)。LC_MESSAGES/messages.po。请编辑 modules/ 或 game_configs_modules/ 中拆分的 .po 文件。static/locales/registry.json 读取,不要在工具或测试里重新维护一份手写语言列表。web/src/components/SystemMenu.vue 中的语言设置项,对非英语 UI 必须保留可见的 Language 英文提示(例如 语言 / Language、言語 / Language),不要在后续润色或本地化时去掉这个 Language。使用 src.i18n 中的 t()。
from src.i18n import t
msg = t("{actor} performs action", actor=self.avatar.name)name_id 和 desc_id)。python tools/i18n/extract_csv.pygame_configs_modules/{category}.po 中进行翻译。python tools/i18n/build_mo.py_desc 和 when_desc 通过翻译键覆盖描述。t("Name"): self.name)。471fe74
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.