<< All versions
Internationalization, RTL Mirroring & Cultural Localization (
3. ICU MessageFormat Dictionary (
Skill v1.0.0
currentAutomated scan100/100darknecrocities/skillbuilder/i18n
──Details
PublishedNovember 25, 2026 at 07:19 PM
Content Hashsha256:7fda2a6063c61be9...
Git SHAf8bce606cc01
──Files
Files (1 file, 4.6 KB)
SKILL.md4.6 KBactive
SKILL.md · 111 lines · 4.6 KB
name: i18n description: Multi-locale internationalization architecture, ICU MessageFormat, RTL bidirectional layout mirroring, and cultural localization. metadata: version: "1.0.0"
Internationalization, RTL Mirroring & Cultural Localization (/i18n)
Philosophy: Zero hardcoded natural language strings in UI code. Layouts must be bidirectional by design. Enforce CSS logical properties over physical left/right. ICU syntax for plurals and gender. Native Intl formatters for dates and currencies.
This skill establishes production architecture for global applications across Next-intl, react-i18next, formatjs, and Flutter Intl/l10n.
1. Quick Navigation & Progressive Disclosure
| Resource Type | Document | Description | |
|---|---|---|---|
| Reference | references/icu-messageformat-guide.md | ICU plural categories, parameter interpolation, number and date formatting. | |
| Reference | references/rtl-layout-mirroring.md | CSS logical properties matrix, directional icon flipping, RTL typography. | |
| Utility | scripts/verify_i18n_hygiene.py | Scans UI code for hardcoded English strings, physical CSS left/right properties, and broken plural syntax. |
2. The Core i18n Architecture Gates
mermaid
flowchart TDA["User Request & Locale Ingress"] --> B["Gate 1: Locale Negotiation (Header, Cookie & Path)"]B --> C["Gate 2: Key Namespace Scoping (feature.component.key)"]C --> D["Gate 3: ICU MessageFormat (Plurals, Select, Gender)"]D --> E["Gate 4: Bidirectional RTL Mirroring (CSS Logical Properties)"]E --> F["Gate 5: Cultural Formatting (Intl.DateTimeFormat & NumberFormat)"]
- Gate 1: Resilient Locale Negotiation: Detect user preference via URL path (
/en/,/ar/,/ja/), cookies, orAccept-Languageheaders, with explicit fallback to default locale. - Gate 2: Zero Hardcoded UI Text: All user-visible strings must reference translation keys via
t('namespace.key'). - Gate 3: ICU Syntax for Pluralization: Prohibit manual ternary string concatenation (
count === 1 ? '1 item' : '${count} items'). Use ICU MessageFormat:{count, plural, one {# item} other {# items}}. - Gate 4: Bidirectional CSS Logical Properties: Use
margin-inline-start,margin-inline-end,padding-inline, andinset-inlineinstead of physicalleft/rightproperties. - Gate 5: Native Currency & Date Localization: Always format numbers, currencies, and dates with native
IntlAPIs (Intl.NumberFormat,Intl.DateTimeFormat).
2. Bidirectional Component Architecture (TypeScript / React)
tsx
import { useTranslations, useLocale } from "next-intl";interface OrderSummaryProps {itemCount: number;totalAmount: number;currency: string;}export function OrderSummary({ itemCount, totalAmount, currency }: OrderSummaryProps) {const t = useTranslations("orders");const locale = useLocale();const formattedPrice = new Intl.NumberFormat(locale, {style: "currency",currency}).format(totalAmount);return (<div className="rounded-xl border border-border p-6 start-aligned"><h2 className="text-xl font-bold tracking-tight text-foreground">{t("summary_title")}</h2><p className="mt-2 text-sm text-muted-foreground">{t("item_count_label", { count: itemCount })}</p><div className="mt-4 flex items-center justify-between border-t border-border pt-4"><span className="font-medium text-foreground">{t("total_label")}</span><span className="font-mono text-lg font-bold text-foreground">{formattedPrice}</span></div></div>);}
3. ICU MessageFormat Dictionary (messages/en.json & messages/ar.json)
json
// messages/en.json{"orders": {"summary_title": "Order Summary","item_count_label": "{count, plural, =0 {No items selected} one {1 item ready for checkout} other {{count} items ready for checkout}}","total_label": "Total Amount"}}
4. Internationalization Hygiene Verification CLI
Audit your repository for hardcoded UI strings and non-logical physical CSS properties:
bash
python3 skills/i18n/scripts/verify_i18n_hygiene.py --path . --strict
Audited Rules:
I18N-HARDCODED-UI-STRING: Flags raw natural language text literals rendered inside JSX tags.I18N-PHYSICAL-CSS-DIRECTION: Flagsmargin-left,padding-right, ortext-align: leftin bidirectional code.I18N-TERNARY-PLURALIZATION: Flags ternary string concatenations instead of ICU plurals.