ericrisco/rsc-harness / skills/translation-l10n
translation-l10n
VerifiedUse when adding a second or Nth language to a web or app product — i18n plumbing (string extraction, ICU messages, locale routing), fixing broken plurals or date formats, and making a UI survive other languages through right-to-left layout and text expansion. NOT defining the brand's tone in one language (that is `brand-voice`).
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 12.2 KB |
| evals/README.md | markdown | 999 B |
| evals/cases.yaml | config | 2.6 KB |
| references/icu-cookbook.md | markdown | 3.2 KB |
| references/rtl-and-bidi.md | markdown | 3.3 KB |
references/icu-cookbook.md
View on GitHub# ICU MessageFormat cookbook
Lookup recipes for the patterns that don't fit inline in SKILL.md. ICU is for plurals and `select` only — format dates/numbers with `Intl.*`, not inside the message.
## Full-sentence pattern (named args)
Never assemble a sentence from fragments. Put the whole sentence in one message and let the translator reorder freely.
```icu
{name} shared {count, plural, one {# photo} other {# photos}} with you
```
The translator owns the entire string, so Japanese or Arabic word order is theirs to set — your call site stays `t("share.summary", { name, count })`.
## Nested plural + select
Combine gender/category selection with pluralization. Each block still needs its own `other`.
```icu
{gender, select,
female {{count, plural, one {She has # follower} other {She has # followers}}}
male {{count, plural, one {He has # follower} other {He has # followers}}}
other {{count, plural, one {They have # follower} other {They have # followers}}}
}
```
## selectordinal — 1st / 2nd / 3rd
`plural` is for cardinals (1 item); `selectordinal` is for ordinals (1st place). English needs `one`/`two`/`few`/`other`; other languages differ.
```icu
You finished {place, selectordinal,
one {#st}
two {#nd}
few {#rd}
other {#th}
}
```
## The `#` token
Inside a `plural`/`selectordinal` block, `#` prints the formatted number for the current locale. Outside such a block it is a literal `#`. Don't reuse the count variable name where `#` already does the job.
## Escaping literals
ICU treats `{`, `}`, and `'` as syntax. To print them literally, wrap in single quotes; a doubled `''` prints one apostrophe.
```icu
This is a literal '{brace}' and an apostrophe '' here.
```
- `'{brace}'` → renders the text `{brace}` unparsed.
- `''` → renders `'`.
- A lone `'` that doesn't open a quoted span is treated as literal in most ICU implementations, but quote it explicitly to be safe.
## Per-language plural categories (quick table)
CLDR rules, summarized. Catalogs for these languages must supply exactly these categories.
| Language | Categories used |
| --- | --- |
| English (en), German (de), Spanish (es) | `one`, `other` |
| French (fr) | `one`, `many`, `other` |
| Russian (ru) | `one`, `few`, `many`, `other` |
| Polish (pl) | `one`, `few`, `many`, `other` |
| Arabic (ar) | `zero`, `one`, `two`, `few`, `many`, `other` |
| Chinese (zh), Japanese (ja), Korean (ko) | `other` only |
A category your language doesn't use is simply ignored; a category it *does* use but you omitted falls through to `other` — often wrong (e.g. Russian "2 файла" needs `few`, not `other`).
## Skeletons (number/date inside ICU)
ICU supports number/date "skeletons" (`{price, number, ::currency/EUR}`), but prefer formatting outside the message with `Intl` so the format stays in code, reviewable and testable, rather than scattered across translator-edited catalogs. Reserve skeletons for cases where the number is grammatically fused into the sentence.
## Validation before ship
Parse every catalog with your ICU library at build time and assert:
- every `plural`/`selectordinal`/`select` has an `other` clause,
- all placeholders present in the source key exist in each translation,
- no unbalanced `{`/`}`.
A failing parse should break CI, not surface at runtime.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |