Internationalization | SheCodes
Intermediate 5 min read

Multiple Languages for AI Coders

Make your app speak every language. Learn how to add multi-language support so users worldwide can use your app in their native tongue.

In this chapter

  • What it takes to make your app speak multiple languages
  • How translation files and locales work in plain English
  • How to ask AI to add language switching to your site
  • Common gotchas with dates, currencies, and right-to-left text

What Is i18n?

i18n stands for "internationalization" (the "18" is the number of letters between the "i" and the "n"). It means building your app so it can be easily translated into different languages and adapted for different regions.

Instead of hardcoding text like "Welcome back" directly in your components, you use translation keys that map to different languages. The app then shows the right text based on the user's language preference.

Key Concepts

Core Locale A language + region code like en-US (English, United States) or es-MX (Spanish, Mexico). Determines which translations to show.
Core Translation Files JSON or YAML files that hold all the text for each language. One file per language, organized by page or feature.
UI Language Switcher A dropdown or button that lets users pick their preferred language. Often shown in the header or footer.
Advanced RTL Support Right-to-left layout for languages like Arabic and Hebrew. Text, icons, and layouts need to mirror horizontally.
Config Fallback Language The default language shown when a translation is missing. Usually English. Prevents blank text from appearing.
Organization Namespaces Groups of translations organized by feature (e.g., 'auth', 'dashboard'). Keeps translation files manageable.

What Needs Translating?

It is not just button labels. Here is everything you need to think about when going multi-language.

  • UI text: Buttons, labels, headings, menus, tooltips
  • Dates & times: 12/25/2025 vs 25.12.2025 depending on locale
  • Numbers: 1,000.50 vs 1.000,50 (separators differ by region)
  • Currencies: $10.00 vs 10,00 EUR (symbols and formatting)
  • Plurals: '1 item' vs '2 items' (rules vary by language)
  • Error messages: Validation errors, alerts, and system messages
  • Email templates: Transactional emails in the user's language
  • SEO metadata: Page titles and descriptions for each language

Tools to Know

Next.js next-intl Built specifically for Next.js. Handles routing, translation loading, and formatting. The go-to choice for Next.js apps.
React react-i18next The most popular React translation library. Works anywhere, massive community, lots of plugins.
Platform Crowdin A platform where translators work on your files. Syncs with GitHub and auto-creates pull requests with new translations.
Platform Lokalise Translation management with a visual editor. Translators can see your app while translating for better context.

How Translations Are Organized

Translation files live in a messages or locales folder. Each language gets its own file with the same keys.

  • messages/en.json: English translations (default)
  • messages/es.json: Spanish translations
  • messages/fr.json: French translations
  • messages/ar.json: Arabic translations (RTL)

Prompt This

Copy-paste these prompts into your AI tool to apply what you just learned.

ADD MULTI-LANGUAGE SUPPORT

“Add multi-language support to my Next.js app. I need [English, Spanish, French]. Set up the translation system and translate my [homepage/navigation/footer].”

BUILD A LANGUAGE SWITCHER

“Create a language switcher that lets visitors toggle between [languages]. Remember their choice so the site stays in that language when they come back.”

Prompt Tips for AI

When asking AI to add internationalization, specify which languages and which library to use.

  • Add multi-language support with English and Spanish using next-intl with a language switcher in the header
  • Extract all hardcoded text on the landing page into translation files for English and French
  • Add RTL support so the layout mirrors correctly when Arabic is selected
  • Format all dates and currency amounts using the user's locale with Intl APIs
  • Create a language dropdown in the nav that switches between English, Spanish, and Japanese

Frequently Asked Questions

When should I add multi-language support?

Add it early if you know your audience speaks multiple languages. Retrofitting translations into an existing app is painful because you have to find and replace every hardcoded text string. Starting with a translation system from day one is much easier.

Which i18n library should I use with Next.js?

next-intl is the most popular choice: it integrates cleanly with Next.js App Router and handles routing, translations, and formatting. For simpler needs, next-translate is lighter weight. Both work well with AI tools.

Do I need to translate my entire site at once?

No. Start with your most important pages (homepage, pricing, and signup). You can progressively translate the rest. Most i18n libraries let you fall back to a default language for untranslated content, so nothing breaks.