Back to results for “Internationalization (i18n) in React”
React › Internationalization (i18n) in React

What is internationalization in a React app and why is it important?

Beginner

Answer

Internationalization, often shortened to i18n, means building an app so it can easily show text in different languages for different users around the world. Instead of hardcoding English text everywhere, you store text in translation files and display the correct one based on the user's chosen language.
// en.json
{ "welcome": "Welcome to our site" }

// fr.json
{ "welcome": "Bienvenue sur notre site" }

function Welcome() {
  const { t } = useTranslation();
  return <h1>{t('welcome')}</h1>;
}
Real-world example An online store expands into new countries by adding translation files for French and Spanish, letting the exact same website automatically show the correct language for each visitor without rewriting any components.

Common follow-ups: How does the app know which language to show a new visitor by default?;What is the difference between internationalization and localization?