i18n-localization

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

31,392 stars
Complexity: medium

About this skill

This skill equips AI agents with the knowledge and tools to effectively implement and manage internationalization (i18n) and localization (L10n) within software projects. By understanding core concepts like locales (e.g., en-US, tr-TR) and Right-to-Left (RTL) language support, the agent can proactively identify hardcoded strings in code, provide guidance on managing translation files, and suggest optimal patterns for creating global-ready applications. It helps ensure that applications are easily translatable and adaptable to diverse linguistic and cultural contexts, moving beyond a single-region mindset to cater to a global user base.

Best use case

Auditing existing codebases for i18n readiness and hardcoded strings. Assisting developers in setting up new projects with proper localization infrastructure. Generating boilerplate for locale files based on specified languages. Providing best practice recommendations for handling pluralization, dates, currencies, and RTL layouts across different languages. Identifying and flagging potential localization issues during code reviews or development cycles.

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

A clearer understanding of i18n/L10n requirements for a project. Identification of hardcoded strings or areas needing internationalization. Recommendations for structuring translation files and managing locale-specific content. Guidance on implementing RTL support and other cultural adaptations. A more robust and globally accessible application ready for multiple languages.

Practical example

Example input

I'm developing a new e-commerce platform and need to ensure it's internationalized from the start. Can you help me identify best practices for managing translations, locale files, and detecting hardcoded strings in my codebase, specifically considering support for English, Spanish, and Arabic?

Example output

Certainly! To internationalize your e-commerce platform effectively for English, Spanish, and Arabic, here are some best practices and steps:

1.  **Centralize Strings**: Avoid hardcoding any user-facing strings directly in your code. Instead, extract them into dedicated translation files.
2.  **Locale Files Structure**:
    *   Organize your translations by locale (e.g., `en.json`, `es.json`, `ar.json`).
    *   Each file should contain key-value pairs where the key is a unique identifier (e.g., `home.welcome_message`) and the value is the translated string.
    *   Example `en.json`: `{"home.welcome_message": "Welcome to our store!"}`
    *   Example `es.json`: `{"home.welcome_message": "¡Bienvenido a nuestra tienda!"}`
    *   Example `ar.json`: `{"home.welcome_message": "مرحبًا بكم في متجرنا!"}`
3.  **Dynamic String Management**: Implement a mechanism (using a library like `react-i18next`, `vue-i18n`, `i18n-js`, etc., depending on your tech stack) to load the correct locale file at runtime and display strings based on the user's selected language.
4.  **Detecting Hardcoded Strings**:
    *   **Manual Review**: Go through UI components and templates. Any plain text directly rendered should be flagged.
    *   **Linting Tools**: Utilize linters (e.g., ESLint plugins for i18n) that can identify untranslated strings.
    *   **Regex Search**: Search your codebase for common string patterns that are likely user-facing.
5.  **RTL Support (for Arabic)**:
    *   **CSS Adjustments**: Ensure your CSS adapts layout for RTL languages. Properties like `text-align: left/right`, `margin-left/right`, `padding-left/right` often need to be mirrored or use logical properties (e.g., `margin-inline-start`, `padding-inline-end`).
    *   **Direction Attribute**: Set `dir="rtl"` on the `<html>` or relevant container element when the locale is an RTL language.
    *   **Icon Mirroring**: Some icons (e.g., arrows) might need to be mirrored horizontally for RTL.
6.  **Contextual Translations**: Account for pluralization, gender, and different date/time/currency formats based on the locale. Libraries can help with this.

**Actionable Step**: I can analyze a provided code snippet or file for hardcoded strings and suggest how to externalize them, or help you outline the initial structure for your locale files.

When to use this skill

  • Developing public web applications or SaaS products targeting a global audience.
  • Expanding an existing application into new international markets.
  • When a significant portion of your user base speaks different languages.
  • To ensure an application correctly supports Right-to-Left (RTL) languages like Arabic or Hebrew.

When not to use this skill

  • For internal tools or single-region applications where there is no current or foreseeable need for multiple languages.
  • If the application explicitly targets a very niche, single-language audience and future expansion is not a concern.
  • When development resources are extremely limited, and i18n is a non-critical feature (though neglecting it early can be costly later).

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/i18n-localization/SKILL.md --create-dirs "https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/plugins/antigravity-awesome-skills-claude/skills/i18n-localization/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/i18n-localization/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How i18n-localization Compares

Feature / Agenti18n-localizationStandard Approach
Platform SupportClaudeLimited / Varies
Context Awareness High Baseline
Installation ComplexitymediumN/A

Frequently Asked Questions

What does this skill do?

Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.

Which AI agents support this skill?

This skill is designed for Claude.

How difficult is it to install?

The installation complexity is rated as medium. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# i18n & Localization

> Internationalization (i18n) and Localization (L10n) best practices.

---

## 1. Core Concepts

| Term | Meaning |
|------|---------|
| **i18n** | Internationalization - making app translatable |
| **L10n** | Localization - actual translations |
| **Locale** | Language + Region (en-US, tr-TR) |
| **RTL** | Right-to-left languages (Arabic, Hebrew) |

---

## 2. When to Use i18n

| Project Type | i18n Needed? |
|--------------|--------------|
| Public web app | ✅ Yes |
| SaaS product | ✅ Yes |
| Internal tool | ⚠️ Maybe |
| Single-region app | ⚠️ Consider future |
| Personal project | ❌ Optional |

---

## 3. Implementation Patterns

### React (react-i18next)

```tsx
import { useTranslation } from 'react-i18next';

function Welcome() {
  const { t } = useTranslation();
  return <h1>{t('welcome.title')}</h1>;
}
```

### Next.js (next-intl)

```tsx
import { useTranslations } from 'next-intl';

export default function Page() {
  const t = useTranslations('Home');
  return <h1>{t('title')}</h1>;
}
```

### Python (gettext)

```python
from gettext import gettext as _

print(_("Welcome to our app"))
```

---

## 4. File Structure

```
locales/
├── en/
│   ├── common.json
│   ├── auth.json
│   └── errors.json
├── tr/
│   ├── common.json
│   ├── auth.json
│   └── errors.json
└── ar/          # RTL
    └── ...
```

---

## 5. Best Practices

### DO ✅

- Use translation keys, not raw text
- Namespace translations by feature
- Support pluralization
- Handle date/number formats per locale
- Plan for RTL from the start
- Use ICU message format for complex strings

### DON'T ❌

- Hardcode strings in components
- Concatenate translated strings
- Assume text length (German is 30% longer)
- Forget about RTL layout
- Mix languages in same file

---

## 6. Common Issues

| Issue | Solution |
|-------|----------|
| Missing translation | Fallback to default language |
| Hardcoded strings | Use linter/checker script |
| Date format | Use Intl.DateTimeFormat |
| Number format | Use Intl.NumberFormat |
| Pluralization | Use ICU message format |

---

## 7. RTL Support

```css
/* CSS Logical Properties */
.container {
  margin-inline-start: 1rem;  /* Not margin-left */
  padding-inline-end: 1rem;   /* Not padding-right */
}

[dir="rtl"] .icon {
  transform: scaleX(-1);
}
```

---

## 8. Checklist

Before shipping:

- [ ] All user-facing strings use translation keys
- [ ] Locale files exist for all supported languages
- [ ] Date/number formatting uses Intl API
- [ ] RTL layout tested (if applicable)
- [ ] Fallback language configured
- [ ] No hardcoded strings in components

---

## Script

| Script | Purpose | Command |
|--------|---------|---------|
| `scripts/i18n_checker.py` | Detect hardcoded strings & missing translations | `python scripts/i18n_checker.py <project_path>` |

## When to Use
This skill is applicable to execute the workflow or actions described in the overview.

Related Skills

nerdzao-elite

31392
from sickn33/antigravity-awesome-skills

Senior Elite Software Engineer (15+) and Senior Product Designer. Full workflow with planning, architecture, TDD, clean code, and pixel-perfect UX validation.

Software DevelopmentClaude

nerdzao-elite-gemini-high

31392
from sickn33/antigravity-awesome-skills

Modo Elite Coder + UX Pixel-Perfect otimizado especificamente para Gemini 3.1 Pro High. Workflow completo com foco em qualidade máxima e eficiência de tokens.

Software DevelopmentClaudeGemini

multi-platform-apps-multi-platform

31392
from sickn33/antigravity-awesome-skills

Build and deploy the same feature consistently across web, mobile, and desktop platforms using API-first architecture and parallel implementation strategies.

Software DevelopmentClaude

monorepo-architect

31392
from sickn33/antigravity-awesome-skills

Expert in monorepo architecture, build systems, and dependency management at scale. Masters Nx, Turborepo, Bazel, and Lerna for efficient multi-project development. Use PROACTIVELY for monorepo setup,

Software DevelopmentClaude

minecraft-bukkit-pro

31392
from sickn33/antigravity-awesome-skills

Master Minecraft server plugin development with Bukkit, Spigot, and Paper APIs.

Software DevelopmentClaude

memory-safety-patterns

31392
from sickn33/antigravity-awesome-skills

Cross-language patterns for memory-safe programming including RAII, ownership, smart pointers, and resource management.

Software DevelopmentClaude

macos-spm-app-packaging

31392
from sickn33/antigravity-awesome-skills

Scaffold, build, sign, and package SwiftPM macOS apps without Xcode projects.

Software DevelopmentClaude

legacy-modernizer

31392
from sickn33/antigravity-awesome-skills

Refactor legacy codebases, migrate outdated frameworks, and implement gradual modernization. Handles technical debt, dependency updates, and backward compatibility.

Software DevelopmentClaude

framework-migration-deps-upgrade

31392
from sickn33/antigravity-awesome-skills

You are a dependency management expert specializing in safe, incremental upgrades of project dependencies. Plan and execute dependency updates with minimal risk, proper testing, and clear migration pa

Software DevelopmentClaude

fp-refactor

31392
from sickn33/antigravity-awesome-skills

Comprehensive guide for refactoring imperative TypeScript code to fp-ts functional patterns

Software DevelopmentClaude

dotnet-backend-patterns

31392
from sickn33/antigravity-awesome-skills

Master C#/.NET patterns for building production-grade APIs, MCP servers, and enterprise backends with modern best practices (2024/2025).

Software DevelopmentClaude

dotnet-architect

31392
from sickn33/antigravity-awesome-skills

Expert .NET backend architect specializing in C#, ASP.NET Core, Entity Framework, Dapper, and enterprise application patterns.

Software DevelopmentClaude