Skip to content
/i18nStable

Finds hardcoded strings, sets up i18n infrastructure, and extracts text into translation files.

FrontendAccessibilityΒ· 2 min read

Quick import: Download the .md file and save it to .claude/commands/ (Claude Code), .cursorrules (Cursor), or paste as a system prompt in ChatGPT, Gemini, or any LLM API.

#What it does

The /i18n skill audits your codebase for internationalization readiness. It finds every hardcoded user-facing string, flags locale-dependent formatting (dates, numbers, currencies), and helps you extract everything into a proper i18n system. Whether you are starting from zero or tightening an existing setup, it catches what manual search misses.

#How to use

bash
/i18n

Run at the project root for a full audit. Target specific directories to scope the work.

bash
/i18n src/components/

#What it finds

  • Hardcoded strings -- Text in JSX, template literals, and attribute values that should use translation keys
  • String concatenation -- Dynamic strings built with + or template literals that break translator context
  • Date/number formatting -- toLocaleDateString() calls missing locale parameters, raw toFixed() for currency
  • Pluralization issues -- Naive count === 1 ? "item" : "items" that breaks in languages with complex plural rules
  • RTL concerns -- CSS that assumes left-to-right layout (hardcoded margin-left, text-align: left)
  • Image text -- Images containing baked-in text that cannot be translated

#Workflow

  1. Scan -- Walks every component and page for user-facing text
  2. Classify -- Separates translatable text from technical strings (CSS classes, API keys, enum values)
  3. Extract -- Generates translation key files in your preferred format (JSON, TypeScript, ICU message syntax)
  4. Refactor -- Replaces hardcoded strings with t('key') calls using your i18n library (next-intl, react-i18next, or similar)
  5. Validate -- Checks that all keys have values and no orphaned keys exist

#Example

bash
> /i18n src/app/
 
## i18n Audit: 156 hardcoded strings found
 
### By category
- UI labels: 72 strings
- Error messages: 34 strings
- Placeholder text: 23 strings
- Button text: 18 strings
- Accessibility labels: 9 strings
 
### Issues
- [HIGH] 12 concatenated strings that need ICU MessageFormat
  Example: `"You have " + count + " items"` -> `t('cart.itemCount', { count })`
- [MEDIUM] 8 dates using `toLocaleDateString()` without explicit locale
- [LOW] 3 images with embedded English text
 
### Generated
- locales/en.json (156 keys)
- locales/keys.ts (type-safe key constants)
Orel OhayonΒ·
View all skills