Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.
Add this skill
npx mdskills install sickn33/i18n-localizationStrong reference guide with clear patterns, examples, and best practices across frameworks
1---2name: i18n-localization3description: Internationalization and localization patterns. Detecting hardcoded strings, managing translations, locale files, RTL support.4allowed-tools: Read, Glob, Grep5---67# i18n & Localization89> Internationalization (i18n) and Localization (L10n) best practices.1011---1213## 1. Core Concepts1415| Term | Meaning |16|------|---------|17| **i18n** | Internationalization - making app translatable |18| **L10n** | Localization - actual translations |19| **Locale** | Language + Region (en-US, tr-TR) |20| **RTL** | Right-to-left languages (Arabic, Hebrew) |2122---2324## 2. When to Use i18n2526| Project Type | i18n Needed? |27|--------------|--------------|28| Public web app | ✅ Yes |29| SaaS product | ✅ Yes |30| Internal tool | ⚠️ Maybe |31| Single-region app | ⚠️ Consider future |32| Personal project | ❌ Optional |3334---3536## 3. Implementation Patterns3738### React (react-i18next)3940```tsx41import { useTranslation } from 'react-i18next';4243function Welcome() {44 const { t } = useTranslation();45 return <h1>{t('welcome.title')}</h1>;46}47```4849### Next.js (next-intl)5051```tsx52import { useTranslations } from 'next-intl';5354export default function Page() {55 const t = useTranslations('Home');56 return <h1>{t('title')}</h1>;57}58```5960### Python (gettext)6162```python63from gettext import gettext as _6465print(_("Welcome to our app"))66```6768---6970## 4. File Structure7172```73locales/74├── en/75│ ├── common.json76│ ├── auth.json77│ └── errors.json78├── tr/79│ ├── common.json80│ ├── auth.json81│ └── errors.json82└── ar/ # RTL83 └── ...84```8586---8788## 5. Best Practices8990### DO ✅9192- Use translation keys, not raw text93- Namespace translations by feature94- Support pluralization95- Handle date/number formats per locale96- Plan for RTL from the start97- Use ICU message format for complex strings9899### DON'T ❌100101- Hardcode strings in components102- Concatenate translated strings103- Assume text length (German is 30% longer)104- Forget about RTL layout105- Mix languages in same file106107---108109## 6. Common Issues110111| Issue | Solution |112|-------|----------|113| Missing translation | Fallback to default language |114| Hardcoded strings | Use linter/checker script |115| Date format | Use Intl.DateTimeFormat |116| Number format | Use Intl.NumberFormat |117| Pluralization | Use ICU message format |118119---120121## 7. RTL Support122123```css124/* CSS Logical Properties */125.container {126 margin-inline-start: 1rem; /* Not margin-left */127 padding-inline-end: 1rem; /* Not padding-right */128}129130[dir="rtl"] .icon {131 transform: scaleX(-1);132}133```134135---136137## 8. Checklist138139Before shipping:140141- [ ] All user-facing strings use translation keys142- [ ] Locale files exist for all supported languages143- [ ] Date/number formatting uses Intl API144- [ ] RTL layout tested (if applicable)145- [ ] Fallback language configured146- [ ] No hardcoded strings in components147148---149150## Script151152| Script | Purpose | Command |153|--------|---------|---------|154| `scripts/i18n_checker.py` | Detect hardcoded strings & missing translations | `python scripts/i18n_checker.py <project_path>` |155
Full transparency — inspect the skill content before installing.