Use this skill when a commit range in one Simplified Chinese language file is the source of truth, and the task is to keep only the current uncommitted changes in sibling i18n files that correspond to those real changes.
Typical requests:
*_zh_CN.js file."*_zh_CN.js file as the source of truth, then trim unrelated pending edits from other language files in the same directory."Turn a noisy set of uncommitted i18n edits into a focused diff that keeps only the changes that are semantically tied to a baseline file's real modifications.
Gather these inputs before editing:
A..B*_zh_CN.jsIf the user does not say otherwise, assume the baseline file is only used for analysis and you should trim the other currently modified sibling language files in the same directory.
Run a diff for the baseline file over the requested range and determine the real changed keys.
Preferred command pattern:
git diff <range> -- <baseline-file>
Do not rely on line numbers alone. Treat these as the real changes:
When reading the patch, extract the i18n keys from changed object entries, for example lines that look like:
'reset' : '重置',
Create the smallest possible key set from the baseline diff.
Include:
foo.old and foo.newDo not include unrelated neighbors just because they share nearby line numbers.
List the currently modified sibling language files in the same directory as the baseline file and narrow to the intended scope.
Preferred command pattern:
git diff --name-only -- <baseline-dir>/*.js
git status --short
Usually this means:
all `*.js` language files in the same directory as the chosen `*_zh_CN.js`
Selection rules:
*_zh_CN.js itself unless the user explicitly asks to trim it toofoo_zh_CN.js and bar_zh_CN.js, only use the one the user named, or the one whose diff range was explicitly providedHEADFor each modified target file:
HEAD as the clean baselineHEAD content with the working tree contentThis is the important rule:
HEAD content for irrelevant keysThat means the output file should effectively be:
HEAD file contentKey-specific handling:
HEAD and in working tree, copy the working tree line back onto the HEAD structureHEAD and was intentionally removed in working tree, keep that removalDo not reorder the whole file unless the file was already reordered. Prefer minimal diffs.
After editing, verify that the remaining diff is limited to the relevant key set.
Recommended checks:
git diff --stat -- <targets>git diff -- <sample-target>The remaining hunks should only touch keys from the relevant key set. If unrelated strings like search, AI, or text mode keys remain, the trim was too broad and should be corrected.
For many sibling language files, scripting the trim is safer than manual editing.
A reliable approach is:
HEADHEAD, overlaying only relevant key changes from the working treeThis approach is especially useful when many language files contain mixed relevant and irrelevant edits.
When reporting back to the user, summarize:
This skill is a strong fit for workflows like:
*_zh_CN.js<sha>..HEADWhere the goal is to keep only the still-uncommitted translation changes in sibling files that truly map to the baseline file's changed keys.