Skip to content

skillFrontend

Frontend i18n

Extracts hard-coded UI text into translation files and handles plurals, dates, numbers and right-to-left layout for a multi-language frontend.

npx workspacetemplates add frontend-i18n --tool claude-code

Writes 1 file to .claude/skills/frontend-i18n/

.claude/skills/frontend-i18n/SKILL.md23 lines · 1.8 KBFile
---
name: frontend-i18n
description: Extracts hard-coded UI text into translation files and handles plurals, dates, numbers and right-to-left layout for a multi-language frontend.
---

# Frontend i18n

Never translate by hand-editing the UI. Extract, key, format, then verify with a pseudo-locale.

## Steps

1. Detect the existing setup (react-i18next, vue-i18n, next-intl, Angular i18n, FormatJS). Use it. Only if none exists, recommend one that supports ICU messages and ask before installing.
2. Extract strings component by component. Keys are namespaced by feature and describe the role, not the English text: `checkout.submit.label`, not `place_your_order`. Add a short note for translators wherever the meaning is ambiguous ("Save" as a verb, "Order" as a noun).
3. Never concatenate. One whole sentence per message with placeholders: `"Welcome back, {name}"`. Word order differs by language.
4. Plurals use ICU: `"{count, plural, one {# file} other {# files}}"`. Some languages have up to six forms, so never write `count === 1 ? ... : ...`.
5. Format with Intl, not by hand: `Intl.DateTimeFormat`, `Intl.NumberFormat` (currency needs the currency code, not a symbol), `Intl.RelativeTimeFormat`, `Intl.ListFormat`. Store dates in UTC ISO and format at render time.
6. Layout. Use logical CSS properties (`margin-inline-start`, `padding-inline`, `text-align: start`), set `dir` and `lang` on the html element, and mirror directional icons, not logos or numerals.
7. Verify with a pseudo-locale that expands text by 40 percent and adds accents. Fix every clipped or overflowing label.
8. Fallbacks: missing keys fall back to the default language and are logged in development, never shown as raw keys.

## Report

Keys added per file, files with remaining hard-coded text, and anything that needs a translator's judgment.

What it does

Internationalization fails in the details: a plural built with a ternary, a date glued together from parts, a button that breaks when the German label is twice as long. This skill sets up a translation workflow and fixes those traps while it extracts the strings.

It uses the platform Intl APIs and ICU message syntax so the result does not depend on one library, and it keeps translators in mind with stable keys and context notes.

Example

you › Extract all strings from src/components/cart and prepare for German and Arabic

agent › Moved 37 strings into locales/en/cart.json with translator notes on 6. Converted 2 plural ternaries to ICU, replaced a hand-built price with `Intl.NumberFormat`, and changed 14 left/right paddings to logical properties. Pseudo-locale showed 3 clipped buttons; fixed with min-width and wrapping.

Questions

Does it translate the text too?
It writes the source language and structure. Machine drafts for other languages are possible on request but should go past a native speaker.
Why does it forbid concatenated sentences?
Grammar and word order change between languages, so a translator must see the whole sentence in one piece.
  • Bundle Size Reduction

    Skilljavascript

    Free