agentleFS
MindrallyMindrally/skills/internationalization-i18n/SKILL.md

internationalization-i18n

Skill266 starsChanged 10 months agoApache-2.0View on GitHub

Implement internationalization (i18n) best practices for web and mobile applications to support multiple languages and locales.

The file

Show its rules and text

We split this skill into the rules it gives an agent

34 rules. About 0 are common, 32 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈32

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write concise, technical TypeScript code with accurate examples

    line 12
  2. Distinctive:

    Use functional and declarative programming patterns.

    line 13
  3. Distinctive:

    Ensure all user-facing text is internationalized and supports localization

    line 14
  4. Distinctive:

    Use descriptive variable names with auxiliary verbs (isLoading, hasError)

    line 15
  5. Distinctive:

    Use i18next and react-i18next for web applications

    line 21
  6. Distinctive:

    Use interpolation for dynamic values in translations

    line 23
  7. Distinctive:

    Use @nuxtjs/i18n module for Vue applications

    line 43
  8. Very specific:

    Use useI18n composable for translations

    line 45
  9. Distinctive:

    Use expo-localization for React Native apps

    line 51
  10. Distinctive:

    Use react-native-i18n or i18n-js for translations

    line 52
  11. Distinctive:

    Ensure proper text scaling for accessibility

    line 58
  12. Distinctive:

    Test on devices with different system languages

    line 60
  13. Very specific:

    Use descriptive, hierarchical keys (e.g., auth.login.button, errors.network.timeout)

    line 82
  14. Distinctive:

    Avoid embedding HTML in translations when possible

    line 83
  15. Distinctive:

    Keep translations context-aware and meaningful

    line 84
  16. Distinctive:

    Document translation context for translators

    line 85
  17. Distinctive:

    Use Intl.DateTimeFormat for date formatting

    line 90
  18. Distinctive:

    Use Intl.NumberFormat for number formatting

    line 96
  19. Distinctive:

    Use Intl.Collator for locale-aware string comparison

    line 102
  20. Distinctive:

    Use CSS logical properties (margin-inline-start, padding-inline-end)

    line 109
  21. Distinctive:

    Test thoroughly with RTL languages (Arabic, Hebrew, etc.)

    line 112
  22. Distinctive:

    Never hardcode user-facing strings

    line 126
  23. Distinctive:

    Use ICU message format for complex translations

    line 128
  24. Distinctive:

    Avoid text in images; use CSS/SVG text when possible

    line 133
  25. Distinctive:

    Use icons with text labels, not icons alone

    line 135
  26. Distinctive:

    Consider cultural differences in imagery and color

    line 136
  27. Distinctive:

    Test with pseudolocalization during development

    line 139
  28. Distinctive:

    Verify text doesn't overflow containers

    line 140
  29. Distinctive:

    Test with actual translations before release

    line 141
  30. Distinctive:

    Verify RTL layout with native speakers

    line 142
  31. Distinctive:

    Test currency and date formats across locales

    line 143
  32. Distinctive:

    Use Zustand or React Context for language state

    line 148
  33. Distinctive:

    Use TanStack React Query for caching translated content

    line 154
  34. Distinctive:

    Use Zod for runtime validation with localized error messages

    line 165

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Internationalization (i18n)

You are an expert in internationalization for web and mobile applications. Apply these guidelines to ensure applications can be easily adapted for different languages, regions, and cultures.

Core Principles

  • Write concise, technical TypeScript code with accurate examples
  • Use functional and declarative programming patterns; avoid classes
  • Ensure all user-facing text is internationalized and supports localization
  • Use descriptive variable names with auxiliary verbs (isLoading, hasError)
  • Design for text expansion (some languages require 30-50% more space)

Web Application i18n

React/Next.js Applications

  • Use i18next and react-i18next for web applications
  • Implement namespace-based translation organization
  • Use interpolation for dynamic values in translations
  • Leverage pluralization features for count-based text
  • Implement context-based translations where needed

Implementation Pattern

// Use translation hooks
const { t } = useTranslation('common');

// Basic translation
<h1>{t('welcome.title')}</h1>

// With interpolation
<p>{t('greeting', { name: userName })}</p>

// With pluralization
<span>{t('items', { count: itemCount })}</span>

Nuxt.js Applications

  • Use @nuxtjs/i18n module for Vue applications
  • Implement SEO best practices with localized routes
  • Use useI18n composable for translations
  • Leverage lazy loading for translation files

React Native/Expo Applications

Mobile i18n Setup

  • Use expo-localization for React Native apps
  • Use react-native-i18n or i18n-js for translations
  • Detect device locale automatically
  • Support fallback languages

Mobile-Specific Considerations

  • Support RTL (right-to-left) layouts
  • Ensure proper text scaling for accessibility
  • Handle device locale changes dynamically
  • Test on devices with different system languages

Translation File Organization

File Structure

locales/
  en/
    common.json
    auth.json
    errors.json
  es/
    common.json
    auth.json
    errors.json
  fr/
    common.json
    auth.json
    errors.json

Translation Keys Best Practices

  • Use descriptive, hierarchical keys (e.g., auth.login.button, errors.network.timeout)
  • Avoid embedding HTML in translations when possible
  • Keep translations context-aware and meaningful
  • Document translation context for translators

Locale-Aware Formatting

Date and Time

  • Use Intl.DateTimeFormat for date formatting
  • Respect user's locale preferences
  • Store dates in UTC, display in local timezone
  • Support multiple date format preferences

Numbers and Currency

  • Use Intl.NumberFormat for number formatting
  • Display currency in user's preferred format
  • Handle decimal and thousand separators by locale
  • Support right-to-left number display where needed

Sorting and Comparison

  • Use Intl.Collator for locale-aware string comparison
  • Implement locale-specific sorting rules
  • Handle diacritics and special characters correctly

RTL (Right-to-Left) Support

Layout Considerations

  • Use CSS logical properties (margin-inline-start, padding-inline-end)
  • Implement bidirectional text support
  • Mirror UI layouts for RTL languages
  • Test thoroughly with RTL languages (Arabic, Hebrew, etc.)

Implementation

/* Use logical properties */
.element {
  margin-inline-start: 1rem;
  padding-inline-end: 0.5rem;
}

Best Practices

Development Guidelines

  • Never hardcode user-facing strings
  • Extract all text to translation files
  • Use ICU message format for complex translations
  • Implement fallback mechanisms for missing translations
  • Support language switching without page reload

Content Considerations

  • Avoid text in images; use CSS/SVG text when possible
  • Design flexible layouts that accommodate text expansion
  • Use icons with text labels, not icons alone
  • Consider cultural differences in imagery and color

Testing Requirements

  • Test with pseudolocalization during development
  • Verify text doesn't overflow containers
  • Test with actual translations before release
  • Verify RTL layout with native speakers
  • Test currency and date formats across locales

State Management for i18n

Storing User Preferences

  • Use Zustand or React Context for language state
  • Persist language preference (localStorage, AsyncStorage)
  • Sync language preference with user account
  • Handle server-side rendering with correct locale

Data Fetching

  • Use TanStack React Query for caching translated content
  • Invalidate queries on language change when needed
  • Fetch locale-specific content from APIs
  • Handle translation loading states gracefully

Error Handling

  • Provide translated error messages
  • Implement fallback to default language for missing translations
  • Log missing translation keys in development
  • Handle RTL/LTR text direction in error displays
  • Use Zod for runtime validation with localized error messages

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.