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/rtl-and-bidi.md
View on GitHub# RTL & bidi reference
Full depth for right-to-left (Arabic, Hebrew, Persian, Urdu) and bidirectional text. The core rule lives in SKILL.md: set `dir` on `<html>`, write layout with CSS logical properties. This file is the complete mapping plus the judgment calls.
## Physical → logical property mapping
Replace physical properties so one stylesheet flips automatically with `dir`/`writing-mode`.
| Physical | Logical |
| --- | --- |
| `margin-left` / `margin-right` | `margin-inline-start` / `margin-inline-end` |
| `padding-left` / `padding-right` | `padding-inline-start` / `padding-inline-end` |
| `left` / `right` | `inset-inline-start` / `inset-inline-end` |
| `border-left` / `border-right` | `border-inline-start` / `border-inline-end` |
| `text-align: left` / `right` | `text-align: start` / `end` |
| `border-top-left-radius` | `border-start-start-radius` |
| `width` / `height` | `inline-size` / `block-size` |
| `float: left` | `float: inline-start` |
Flexbox/grid: `flex-start`/`flex-end` and `start`/`end` already follow direction — prefer them over `left`/`right`. Use `justify-content: flex-start`, not absolute positioning, where possible.
## Bidi isolation for interpolated content
User-supplied or locale-foreign text embedded in a sentence can reorder surrounding characters (the "bidi spillover" bug: a Hebrew name pushes an LTR punctuation mark to the wrong side).
- HTML: wrap the interpolated value in `<bdi>` — it isolates the embedded run's direction.
- CSS: `unicode-bidi: isolate` on the wrapper achieves the same.
- `dir="auto"` on an input/element lets the browser infer direction from the first strong character — useful for user-generated content fields whose language you don't know.
```html
<span>@<bdi>{{username}}</bdi> mentioned you</span>
```
## Mirror vs. don't mirror
When `dir="rtl"`, layout flips — but not every graphic should.
**Mirror** (directional meaning): back/forward arrows, breadcrumb chevrons, progress that advances, list bullets/indentation, send/reply arrows, undo/redo.
**Do NOT mirror** (physical/absolute meaning): media play button (always points to time-forward, conventionally right), clocks, musical notation, checkmarks, logos and brand marks, photos, phone/email/numbers that read LTR even in RTL context, charts with a real x-axis.
Implement icon mirroring with a logical transform scoped to RTL:
```css
[dir="rtl"] .icon-directional { transform: scaleX(-1); }
```
Keep a single explicit class for mirrored icons rather than flipping all of them.
## Numbers, dates, and embedded LTR
Numbers and Latin product names stay LTR even inside RTL text — the bidi algorithm handles this if you don't fight it. Don't force `direction` on number spans; let `Intl.NumberFormat` with the locale render digits (Arabic-Indic vs. Western) and let bidi place them.
## Testing RTL
1. **Pseudo-RTL locale.** Add a fake locale that forces `dir="rtl"` plus pseudolocalized strings to smoke-test layout flip without real translations.
2. **Snapshot one real RTL locale** (ar) in visual regression.
3. **Tab order + focus**: verify keyboard navigation follows visual order after the flip.
4. **Check truncation/ellipsis**: `text-overflow` and gradient fades must sit on the logical end, not a hardcoded right edge.
5. **Mixed content**: render an LTR username/number inside an RTL sentence and confirm no spillover.
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: 323k | 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 |