Skip to content
Back to skills

I18n Localization

ASecurity

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.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
ai-agentstypescriptgobashreactnextjsapi

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add Harmitx7/tribunal-kit --skill i18n-localization --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of I18n Localization?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for I18n Localization
[![Security: A β€” Skills Directory](https://www.skillsdirectory.com/api/skills/harmitx7-i18n-localization-tribunal-kit/badge)](https://www.skillsdirectory.com/skills/harmitx7-i18n-localization-tribunal-kit)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.md4 KB
  • scripts/i18n_checker.py7.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…