i18n-frontend-translate
Skill897 starsChanged 52 days agoMITView on GitHub
Batches translation of locale JSON using show-untranslated and set-translation scripts, with codebase lookup for message IDs when context is unclear. Use when the user asks to translate frontend strings, reduce untranslated entries for a locale, or apply translation rules to lang files.
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 4 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
List work: Run show-untranslated with a small batch so the task stays reviewable:
- Very specific: line 31
Read the line: {id}: {english}.
- Distinctive: line 32
If meaning, audience, or UI role is unclear, find context before translating (see below).
- Very specific: line 46
Update progress: After finishing (or when the user stops), refresh locale completion percentages in lib/constants/locales.js:
- Distinctive: line 58
Use when the English line alone is ambiguous (button vs heading, legal vs casual, technical sense).
- Very specific: line 60
Search the repo for the id (appears in FormattedMessage, defineMessages, intl.formatMessage, etc.):
- Very specific: line 76
Keep ICU placeholders and rich-text tags exactly as in English unless the target language requires a different order: {name}, {count}, …
- Distinctive: line 77
Do not invent new placeholders or remove required tags.
- Very specific: line 78
Prefer consistent product terminology with the rest of lang/<locale>.json when the same concept appears elsewhere.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
i18n Frontend Translate
When to Use
- User gives a locale (e.g.
fr,pt-BR) and optionally instructions. - Goal is to replace locale strings that still equal English with proper translations, using the repo scripts.
Preconditions
- Work from this repository root.
lang/<locale>.jsonmust exist. English source of truth islang/en.json.
Workflow (loop)
- User inputs:
locale+ free-text instructions (follow them for register, formality, product terms, and consistency). List work: Run show-untranslated with a small batch so the task stays reviewable:
npx tsx scripts/i18n/show-untranslated.ts <locale> --limit 30Increase
--limitor re-run without--limitwhen draining the backlog.Per string:
- Read the line:
{id}: {english}. - If meaning, audience, or UI role is unclear, find context before translating (see below).
- If the string should stay English in this locale (same word in both languages, standard loanword, product name, etc.), do not run
set-translation. Add the message id toIGNORED['<locale>']inscripts/i18n/translation-stats.tsso it stops appearing in the report. Keep a short inline comment per entry (e.g. why it is not translated). Ignore matching is by id, not by English value. - Otherwise produce the target-language string that matches instructions and preserves placeholders/markup, then apply:
npx tsx scripts/i18n/set-translation.ts <locale> <id> "Translation text"Quote the translation so the shell does not split words.
- Read the line:
- Repeat step 2 until show-untranslated returns nothing (or the user stops).
- Sanity check: Optionally re-run show-untranslated for that locale; remaining lines should be actual translation work, or items intentionally listed under
IGNORED. Update progress: After finishing (or when the user stops), refresh locale completion percentages in
lib/constants/locales.js:npm run langs:update-progress
Intentionally identical strings (IGNORED)
show-untranslated reports ids whose locale value still equals English, minus IGNORED for that locale. When a value is correctly left as English, register the message id under IGNORED in scripts/i18n/translation-stats.ts. Otherwise the loop never clears.
Finding context for a message id
Use when the English line alone is ambiguous (button vs heading, legal vs casual, technical sense).
Search the repo for the id (appears in
FormattedMessage,defineMessages,intl.formatMessage, etc.):rg -l '<id>' --glob '*.{tsx,ts,js,jsx}'Example:
rg -l 'Ri4REE' --glob '*.{tsx,ts,js,jsx}'- Open the matching file(s) and read surrounding UI: labels, modals, routes, audience.
- For duplicate or generic English, context disambiguates (e.g. "Order" as noun vs verb).
- Compare with other languages or
en.jsonby searchinglang/.
Preservation rules
- Keep ICU placeholders and rich-text tags exactly as in English unless the target language requires a different order:
{name},{count},{amount},<Link>...</Link>,<Account></Account>, etc. - Do not invent new placeholders or remove required tags.
- Prefer consistent product terminology with the rest of
lang/<locale>.jsonwhen the same concept appears elsewhere.
Scripts reference
| Script / npm script | Role |
scripts/i18n/show-untranslated.ts | Lists {id}: english where locale value still equals English, minus per-locale IGNORED message ids. Optional --limit N. |
scripts/i18n/set-translation.ts | Writes one key: set-translation.ts <locale> <id> "text" |
npm run langs:update-progress | Recomputes per-locale completion % and writes lib/constants/locales.js. Run once when done. |
Show-untranslated and set-translation are invoked with npx tsx from the repository root.
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

