πŸŽ‰ 75% of content is free forever β€” Unlock Premium from $10/mo β†’
CW
Search courses…
πŸ’Ό Servicesℹ️ Aboutβœ‰οΈ ContactView Pricing Plansfrom $10

Internationalization (i18n)

React Utilities🟒 Free Lesson

Advertisement

Internationalization (i18n)

Translation management, locale detection, pluralization, and RTL support.

Overview

i18n enables React apps to support multiple languages and regional formats.

Key Concepts

  • react-i18next β€” Popular i18n framework for React
  • Translation Files β€” JSON/JS files with translated strings
  • Locale Detection β€” Browser language detection
  • Pluralization β€” Handle singular/plural forms
  • RTL Support β€” Right-to-left language layouts

Code Examples

import { I18nextProvider, useTranslation } from 'react-i18next';
import i18n from 'i18next';

i18n.init({
  resources: {
    en: { translation: { greeting: 'Hello, {{name}}!', items: '{{count}} item' } },
    es: { translation: { greeting: 'Hola, {{name}}!', items: '{{count}} artΓ­culo' } }
  },
  lng: 'en',
  interpolation: { escapeValue: false }
});

function Greeting() {
  const { t } = useTranslation();
  return <h1>{t('greeting', { name: 'World' })}</h1>;
}

function ItemCount({ count }) {
  const { t } = useTranslation();
  return <p>{t('items', { count })}</p>;
}

function LanguageSwitcher() {
  const { i18n } = useTranslation();
  return (
    <select onChange={e => i18n.changeLanguage(e.target.value)}>
      <option value="en">English</option>
      <option value="es">EspaΓ±ol</option>
    </select>
  );
}

Practice

Add i18n support to a React app with at least 3 languages and proper pluralization.

⭐

Premium Content

Internationalization (i18n)

Unlock this lesson and 900+ advanced tutorials with a Premium plan.

🎯End-to-end Projects
πŸ’ΌInterview Prep
πŸ“œCertificates
🀝Community Access

Already a member? Log in

Need Expert React Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement