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
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
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 translationsmessages/fr.json: French translationsmessages/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 to my Next.js app. I need [English, Spanish, French]. Set up the translation system and translate my [homepage/navigation/footer].”
“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.