Fix Err I18n Translations
Purpose
Use this skill to repair machine-translated i18n resource entries marked with <err>. A marker means the text was detected as wrong and must be translated again from the matching Simplified Chinese baseline, not simply removed.
Required Workflow
Find the latest relevant source of <err> markers.
- Prefer the current working tree if markers still exist.
- If a previous attempt may have removed markers, recover the marker scope from git with
git log -S'<err>' and git show <commit>:<file>.
- Do not rely on line numbers alone when files may have shifted; pair line data with key names for
.properties files.
Locate the Simplified Chinese baseline file.
- For files named like
help_es.properties, use the sibling help_zh_CN.properties.
- For other suffix patterns, replace the locale suffix with
_zh_CN while preserving the basename and extension.
- If no baseline exists, stop and report the missing file.
Extract only the marked text fragments.
- For
.properties, parse logical entries, including continuation lines ending with \.
- For HTML-valued entries, preserve tags, attributes, paths, entities, indentation, and trailing continuation backslashes.
- Translate only visible text inside tags or plain text values. Do not translate tag names, attributes,
style, class, src, placeholders, variables, or image filenames.
- If a line has
<err>, retranslate the corresponding Chinese visible text at the same structural position, then remove <err>.
Replace narrowly.
- Keep unrelated translated lines untouched.
- Keep the original file encoding.
- For CJK target languages, still preserve HTML structure exactly; only the visible text changes.
Validate before reporting completion.
- Count remaining
<err> markers; it must be 0 in the handled files.
- Decode every modified file with the original encoding.
- Compare HTML tag sequences before and after for every originally marked line; mismatches must be
0.
- Run
git diff --check -- <modified files>.
- Inspect diffs for accidental baseline changes or unrelated edits.
Helper Script
Use scripts/audit_err_i18n.py to list marker scope and validate structure. The script does not translate; it makes the fragile discovery and verification steps deterministic.
Common usage:
python3 /path/to/fix-err-i18n-translations/scripts/audit_err_i18n.py \
--lang-dir <lang-resource-dir> \
--commit <commit-with-err-markers> \
--mode report
After edits:
python3 /path/to/fix-err-i18n-translations/scripts/audit_err_i18n.py \
--lang-dir <lang-resource-dir> \
--commit <commit-with-err-markers> \
--mode validate
Translation Rules
- Preserve product terms when the target language commonly uses them:
AI, Agent, ICS, HTML, MCP.
- Preserve UI label quoting consistently with nearby translations in the same file.
- Keep punctuation natural for the target language, but do not alter surrounding HTML structure.
- For very long paragraphs, translate the whole visible paragraph from Chinese to keep terminology consistent.
- If uncertain about a target language phrase, prefer clear literal product UI wording over fluent paraphrase that changes meaning.
Red Flags
- Deleting
<err> without changing the text.
- Replacing an entire HTML entry with translated text that drops tags or attributes.
- Translating image paths like
ai_02_zh.jpg or CSS attributes.
- Changing
*_zh_CN.* baseline files.
- Letting shell tools corrupt non-UTF-8 resource files.
1---2name: fix-err-i18n-translations3description: Retranslate i18n resource text marked with <err> from the matching *_zh_CN.* baseline while preserving HTML tags, attributes, placeholders, file encoding, and unrelated edits. Use when a user asks to handle machine-translation error markers, fix <err> labels in language resource files, or retranslate only the erroneous parts of properties/js i18n files based on Chinese source text.4---56# Fix Err I18n Translations78## Purpose910Use this skill to repair machine-translated i18n resource entries marked with `<err>`. A marker means the text was detected as wrong and must be translated again from the matching Simplified Chinese baseline, not simply removed.1112## Required Workflow13141. Find the latest relevant source of `<err>` markers.15 - Prefer the current working tree if markers still exist.16 - If a previous attempt may have removed markers, recover the marker scope from git with `git log -S'<err>'` and `git show <commit>:<file>`.17 - Do not rely on line numbers alone when files may have shifted; pair line data with key names for `.properties` files.18192. Locate the Simplified Chinese baseline file.20 - For files named like `help_es.properties`, use the sibling `help_zh_CN.properties`.21 - For other suffix patterns, replace the locale suffix with `_zh_CN` while preserving the basename and extension.22 - If no baseline exists, stop and report the missing file.23243. Extract only the marked text fragments.25 - For `.properties`, parse logical entries, including continuation lines ending with `\`.26 - For HTML-valued entries, preserve tags, attributes, paths, entities, indentation, and trailing continuation backslashes.27 - Translate only visible text inside tags or plain text values. Do not translate tag names, attributes, `style`, `class`, `src`, placeholders, variables, or image filenames.28 - If a line has `<err>`, retranslate the corresponding Chinese visible text at the same structural position, then remove `<err>`.29304. Replace narrowly.31 - Keep unrelated translated lines untouched.32 - Keep the original file encoding.33 - For CJK target languages, still preserve HTML structure exactly; only the visible text changes.34355. Validate before reporting completion.36 - Count remaining `<err>` markers; it must be `0` in the handled files.37 - Decode every modified file with the original encoding.38 - Compare HTML tag sequences before and after for every originally marked line; mismatches must be `0`.39 - Run `git diff --check -- <modified files>`.40 - Inspect diffs for accidental baseline changes or unrelated edits.4142## Helper Script4344Use `scripts/audit_err_i18n.py` to list marker scope and validate structure. The script does not translate; it makes the fragile discovery and verification steps deterministic.4546Common usage:4748```bash49python3 /path/to/fix-err-i18n-translations/scripts/audit_err_i18n.py \50 --lang-dir <lang-resource-dir> \51 --commit <commit-with-err-markers> \52 --mode report53```5455After edits:5657```bash58python3 /path/to/fix-err-i18n-translations/scripts/audit_err_i18n.py \59 --lang-dir <lang-resource-dir> \60 --commit <commit-with-err-markers> \61 --mode validate62```6364## Translation Rules6566- Preserve product terms when the target language commonly uses them: `AI`, `Agent`, `ICS`, `HTML`, `MCP`.67- Preserve UI label quoting consistently with nearby translations in the same file.68- Keep punctuation natural for the target language, but do not alter surrounding HTML structure.69- For very long paragraphs, translate the whole visible paragraph from Chinese to keep terminology consistent.70- If uncertain about a target language phrase, prefer clear literal product UI wording over fluent paraphrase that changes meaning.7172## Red Flags7374- Deleting `<err>` without changing the text.75- Replacing an entire HTML entry with translated text that drops tags or attributes.76- Translating image paths like `ai_02_zh.jpg` or CSS attributes.77- Changing `*_zh_CN.*` baseline files.78- Letting shell tools corrupt non-UTF-8 resource files.