Translation Updates Skill
Automatically translates changes made to src/langs/json/en.json in the current branch to all other language files.
Important: Only Modified Keys
This skill ONLY translates keys that have been modified or added in the current branch. It does NOT translate pre-existing keys that are missing translations.
How it works
- •Detect changes: Uses
git diffto find modified keys in en.json (both uncommitted and committed changes) - •Extract modified keys: Parses the diff to identify new or changed English strings
- •Translate: Generates appropriate translations for each supported language
- •Update files: Applies translations to language-specific JSON files
Supported Languages
- •German (de.json)
- •Spanish (es.json)
- •French (fr.json)
- •Italian (it.json)
- •Russian (ru.json)
- •Ukrainian (uk.json)
All files are located in src/langs/json/
Usage
After modifying strings in en.json, simply ask:
translate the changes to en.json
Or invoke the skill directly:
/translate-changes
Workflow
Step 1: Detect modifications
The skill detects changes from two sources:
# Uncommitted changes (working directory + staged) git diff HEAD -- src/langs/json/en.json # Committed changes in current branch git diff main...HEAD -- src/langs/json/en.json
This captures both uncommitted modifications and changes committed in the current branch compared to main.
Step 2: Parse changes
Look for lines starting with + in the diff that contain JSON keys:
- •Lines like
+ "keyName": "Value"indicate additions or modifications - •Ignore lines that are just structural changes (commas, brackets)
Step 3: Extract key paths
For each modified line, determine:
- •The full JSON path (e.g.,
addonDispatchDialog.signedOut) - •The new English value
Step 4: Translate
For each modified key:
- •Generate translations for all 6 languages
- •Maintain the same HTML structure (e.g.,
<a href="{href}">text</a>) - •Preserve placeholders like
{href},{n}, etc. - •Match the tone and formality of existing translations in that language
Step 5: Update files
For each language file:
- •Read the current content
- •Locate the key to update using the JSON path
- •Use Edit tool to update the specific key
- •Preserve JSON formatting and structure
Translation Guidelines
- •Maintain HTML: If English has HTML tags, keep them in translations
- •Preserve placeholders: Variables like
{href},{n}, etc. must stay unchanged - •Match formality: Use the same level of formality as existing translations
- •ICU format: Respect plural rules (e.g.,
{n, plural, one {...} other {...}}) - •Context aware: Consider the key path for context (e.g., button vs paragraph text)
Example Translations
English:
"signedOut": "You must <a href=\"{href}\">sign in</a> before dispatching this add-on."
Translations should maintain:
- •The
<a href="{href}">structure - •The
{href}placeholder - •Appropriate word order for each language
Output Format
After translating, show:
- •Summary of changes detected
- •List of keys modified
- •Confirmation of files updated
- •Verification command to check results
Verification
After updates, verify with:
for file in src/langs/json/{de,es,fr,it,ru,uk}.json; do
echo "=== $file ==="
jq -r '.path.to.modified.key // "MISSING"' "$file"
done
Notes
- •JSON files use Unicode escape sequences (e.g.,
\u00e9for é) - •The Edit tool will preserve this encoding automatically
- •Always use Edit tool, not Bash sed/awk, to maintain JSON validity
- •Files should remain valid JSON after updates