Skill: i18n string extraction pass

Hunt hardcoded UI strings and extract them into the i18n system with consistent keys and context.

Published 2026-11-09 · Translation: VI

What to do first

  • Extract before you translate. Wrapping a string in t() with an English default is not the same as shipping a locale.
  • Keys follow the project’s convention (prefix, casing, nesting). Do not invent a second naming scheme in one PR.
  • Preserve placeholders and plural forms. "Hello " + name is a grammar bug waiting for German or Vietnamese.

Ask an agent to “add i18n to this component” and it often wraps every literal, invents keys like text1, and leaves "You have " + count + " items" as concatenation. The UI looks localized in English and breaks the moment a translator needs word order or plurals.

This skill is an extraction pass: find user-visible strings, classify them, propose keys with translator context, replace safely, then list what still cannot be extracted (images with text, server errors). Pair it with your team’s onboarding docs so new hires know where catalogs live.

Part 1: Classify before rewriting

Classify

Classify

Scan the changed UI files. Every literal gets one label:

Label Meaning
EXTRACT User-visible copy → catalog + i18n call
LITERAL Brand, API error code, or identifier that must stay
REDESIGN Dynamic concatenation / template that needs ICU or redesign
Scan these files for user-visible string literals:
[paste paths or diff]

For each literal return: quote, file:line, EXTRACT | LITERAL | REDESIGN, reason.
Do not edit files yet. Do not invent translations.
Skip code identifiers, enum values, and test fixtures unless they render in UI.

Part 2: Keys, replace, leftover check

After you approve the list:

For every EXTRACT item:
1. Propose a key matching [convention: e.g. feature.screen.element]
2. Add translator context comment (where it appears, max length if known)
3. Replace the literal with the project's i18n call
4. For counts/dates, use plural/ICU forms: never string concat

Then list remaining risks: hardcoded alt/aria, images with text, server messages.
Do not translate into other locales unless asked.

Save it as a skill file

# Skill: i18n-extract
## When
- UI PR with hardcoded copy, or before a new locale launch
## Hard rules
1. Extract before translate (unless explicitly asked to translate).
2. Follow project key conventions; one scheme per repo.
3. Preserve placeholders / ICU plurals; no "Hello " + name.
4. Brands and debug-stable codes may stay LITERAL.
## Steps

![Extract Loop](/images/articles/skill-for-i18n-pass/en/02-extract-loop.jpg)

*Extract Loop*

1. Scan user-visible literals.
2. Classify EXTRACT / LITERAL / REDESIGN; show list and stop.
3. After confirm: keys + context + replace.
4. Leftover risk summary.
## Done when
- In-scope strings extracted or justified; leftovers listed.

Test before you trust it

  1. Hardcoded button. "Save changes" in a component. Pass: EXTRACT with a conventional key.
  2. Brand name. Product name in a heading. Pass: LITERAL, not stuffed into the catalog.
  3. Plural concat. "You have " + n + " files". Pass: REDESIGN with plural forms, not three concatenated keys.

Common traps

Failure modes to catch early

Failure modes to catch early

  • Concatenating sentences. Use ICU / named placeholders.
  • Translating API error codes that support needs stable. Keep LITERAL; localize the user-facing message separately.
  • Random keys per file. One prefix map in the skill or sibling doc.
  • Skipping alt text and aria-labels. They are user-visible too.

You are done when a translator can work from keys + context comments without opening the component: and Vietnamese (or any locale) can reorder words without breaking the UI.

Share

X Facebook LinkedIn