Back to skills
SKILL.md
I18n Localization
ASecurityUse when Internationalization (i18n) and localization mastery. Abstracting hardcoded strings, managing JSON/YAML translation dictionaries, bidirectional routing (RTL support for Arabic/Hebrew), Pluralization algorithms, date/currency formatting, and SSR locale detection in Next.js/React. Use when preparing an application for global multilingual scaling.
- 5 stars
- 0 votes
- 0 copies
- 0 views
- Added September 27, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add Harmitx7/tribunal-kit --skill i18n-localization --agent claude-codeAre you the author of I18n Localization?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/harmitx7-i18n-localization-tribunal-kit)---
name: i18n-localization
description: "Use when Internationalization (i18n) and localization mastery. Abstracting hardcoded strings, managing JSON/YAML translation dictionaries, bidirectional routing (RTL support for Arabic/Hebrew), Pluralization algorithms, date/currency formatting, and SSR locale detection in Next.js/React. Use when preparing an application for global multilingual scaling."
version: 5.0.0
last-updated: 2026-09-13
skills:
- nextjs-react-expert
- adapt
- baseline-ui
tools: Read, Grep, Glob, Bash, Edit, Write
scripts-binding:
- .agent/scripts/lint_runner.js
- .agent/scripts/verify_all.js
---
# i18n & Localization β Global Scale Mastery
---
## π οΈ Technical Architecture & Reference Recipes
---
## Hallucination Traps (Read First)
- β Concatenating translated strings (`'Hello ' + name`) -> β
Use interpolation: `t('greeting', { name })` to handle word order differences
- β Hardcoding date/number formats -> β
Use `Intl.DateTimeFormat` and `Intl.NumberFormat` with the user's locale
- β Assuming all languages read left-to-right -> β
Arabic, Hebrew, Farsi are RTL; use CSS `dir='auto'` and logical properties
- β Using string length for validation on translated text -> β
Translations can be 30-200% longer than English; design for expansion
---
---
## 1. The i18n Architecture (Next.js / React)
Do not hardcode strings inside UI components. Use a standardized library (e.g., `next-intl` or `react-i18next`).
### Step 1: Dictionary Abstraction
```json
// messages/en.json
{
"Dashboard": {
"welcomeMessage": "Welcome back, {name}!",
"unreadAlerts": "{count, plural, =0 {No unread alerts} one {You have 1 unread alert} other {You have # unread alerts}}"
}
}
```
### Step 2: Component Implementation
```tsx
// β BAD: Hardcoded English text and manual variable interpolation
export function Header({ user, alertCount }) {
return (
<h1>
Welcome back, {user.name}! You have {alertCount} alerts.
</h1>
);
}
// β
GOOD: i18n Abstraction (using next-intl)
import { useTranslations } from 'next-intl';
export function Header({ user, alertCount }) {
const t = useTranslations('Dashboard');
return (
<header>
<h1>{t('welcomeMessage', { name: user.name })}</h1>
<p>{t('unreadAlerts', { count: alertCount })}</p>
</header>
);
}
```
---
## 2. Advanced Native Formatting (`Intl`)
Do not install `moment.js` or write massive regex string parsers to format currencies in Euros vs Dollars. The browser handles this natively with the `Intl` API.
```typescript
// Data/Currency Formatting correctly tied to the active locale
const locale = 'de-DE';
// β
Currency
const price = new Intl.NumberFormat(locale, { style: 'currency', currency: 'EUR' }).format(1200.5);
// Output in Germany: "1.200,50 β¬"
// β
Dates
const date = new Intl.DateTimeFormat(locale, { dateStyle: 'full' }).format(new Date());
// Output in Germany: "Freitag, 2. April 2026"
// β
Relative Time
const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });
rtf.format(-2, 'day'); // Output: "vorgestern" (the day before yesterday)
```
---
## 3. Bidirectional Architecture (RTL)
For languages like Arabic and Hebrew, the UI must fundamentally flip horizontally. Right-To-Left (RTL) breaks standard CSS `marginLeft` and `marginRight`.
**The Solution:** Logical CSS Properties.
Tailwind v4 (and modern CSS) natively supports logical direction.
```css
/* β BAD: Hardcoded physical space */
.btn {
margin-left: 10px;
} /* Will break layout in Hebrew */
/* β
GOOD: Logical spacing (Tailwind: ms-4, me-4) */
.btn {
margin-inline-start: 10px;
} /* Automatically flips in RTL mode */
```
_In React HTML tag:_ `<html lang="ar" dir="rtl">`
---
## 4. Routing and SSR Detection
Users should not face English UI natively in Japan. Detect their browser headers at the edge routing layer.
In Next.js Middleware:
1. Parse the incoming `Accept-Language` header.
2. Intercept requests to `/dashboard`.
3. Rewrite URL to the detected locale (e.g., `/ja/dashboard`).
Files in this skill
- SKILL.md
- scripts/i18n_checker.py
Attribution
Comments
Loading commentsβ¦