I am going to bootstrap together a simple React application using create-react-app:
npx create-react-app my-app
Next, let’s cd
into the React app directory and install a few i18next packages:
npm install i18next react-i18next i18next-http-backend i18next-browser-languagedetector --save
Don’t worry, these packages are all very lightweight and easy to use. Here’s what they do:
i18next: The base i18next library.
react-i18next: Gives us React-friendly hooks, components, and functions for i18next.
i18next-http-backend: Let’s us use AJAX for loading translation files.
i18next-browser-languagedetector: Detects your users’ preferred language based on browser settings.
Let’s start up our development server with npm start
Here we go!