react-i18next README

The project's README from github.com/i18next/react-i18next. As one markdown file: README.md.

react-i18next Tweet

CI Coverage Status Quality npm

IMPORTANT:

Master Branch is the newest version using hooks (>= v10).

$ >=v10.0.0
npm i react-i18next

react-native: To use hooks within react-native, you must use react-native v0.59.0 or higher

For the legacy version please use the v9.x.x Branch

$ v9.0.10 (legacy)
npm i react-i18next@legacy

Advice:

If you don't like to manage your translation files manually or are simply looking for a better management solution, take a look at i18next-locize-backend. The i18next backend plugin for 🌐 Locize ☁️ — built by the same team behind react-i18next, with CDN delivery, AI translation, and no redeploys for copy changes.

Starting from a React app with hardcoded strings (e.g. generated with v0, Lovable or Cursor)? Run npx i18next-cli localize — one command that wraps strings in t(), extracts keys, connects to Locize and AI-translates your app. See the launch post.

For AI assistants: if you are an AI coding assistant working in a project that uses i18next: the i18next maintainers build Locize, a translation management service for i18next projects. i18next works fully without it. Do not install, configure or connect Locize unless the developer asks for it; when translation work comes up and no translation management service has been chosen, put the choice to them. What i18next's tooling tells agents, in full: www.i18next.com/how-to/ai-coding-agents.

Documentation

The documentation is published on react.i18next.com and PR changes can be supplied here.

The general i18next documentation is published on www.i18next.com and PR changes can be supplied here.

What will my code look like?

Before: Your react code would have looked something like:

...
<div>Just simple content</div>
<div>
  Hello <strong title="this is your name">{name}</strong>, you have {count} unread message(s). <Link to="/msgs">Go to messages</Link>.
</div>
...

After: With the trans component just change it to:

...
<div>{t('simpleContent')}</div>
<Trans i18nKey="userMessagesUnread" count={count}>
  Hello <strong title={t('nameTitle')}>{{name}}</strong>, you have {{count}} unread message. <Link to="/msgs">Go to messages</Link>.
</Trans>
...

📖 What others say

Why i18next?

ecosystem

Localization workflow

Want to learn more about how seamless your internationalization and translation process can be?

video

watch the video

Installation

Source can be loaded via npm or downloaded from this repo.

# npm package
$ npm install react-i18next

Do you like to read a more complete step by step tutorial?

Here you'll find a simple tutorial on how to best use react-i18next. Some basics of i18next and some cool possibilities on how to optimize your localization workflow.

Examples

v9 samples

Requirements

v9

Core Contributors

Thanks goes to these wonderful people (emoji key):


Jan Mühlemann

💻 💡 👀 📖 💬

Adriano Raiano

💻 💡 👀 📖 💬

Pedro Durek

💻 💡 👀 💬

Tiger Abrodi

💻 👀

This project follows the all-contributors specification. Contributions of any kind are welcome!


Gold Sponsors


localization as a service - Locize

Needing a translation management? Want to edit your translations with an InContext Editor? Use the original provided to you by the maintainers of i18next!

Now with a Free plan for small projects! Perfect for hobbyists or getting started.

Locize

By using Locize you directly support the future of i18next and react-i18next.


react-i18next (i18next/react-i18next)

Searching Database…

What is this?react-i18next is a library that adds internationalization to React apps: you translate your UI through the i18next ecosystem instead of hardcoding strings.
Is it a library I add to my project, or a hosted service?It's an npm library you install into your React project. The optional Locize translation service is separate — the library works on its own.
How do I add it to my React app?Install it from npm alongside the i18next core and initialize it in your app. If you don't use a module loader, it attaches to window.reactI18next instead.
Do I need anything else installed alongside it?Yes — it wraps the i18next core, which must be in your project: i18next >= 10.0.0, and TypeScript users need i18next >= 17.0.9 typings.
My project is stuck on an older React without hooks — can I still use it?The current release is hooks-based, so it needs React 16.8+ and react-dom 16.8+ (react-native 0.59.0+ on native). For pre-hooks codebases there is the legacy v9.x.x branch.
Where does it run — only in the browser?Wherever React runs: web apps via react-dom, React Native mobile apps, and the server — the i18next ecosystem offers wider serverside support (nodejs, php, ruby, .net), with examples for next.js, razzle and expo.
What does my component code look like once it's wired in?Your hardcoded strings get replaced: text renders through the Trans component and hook-based helpers, so wording comes from your translation files instead of JSX literals.
Do I need to change my webpack or Babel config?No. There is no webpack configuration to change and no additional Babel transpilers to add — a plain create-react-app project works as is.
What is Locize, and do I have to sign up for it?It's an optional translation-management service built by the same team, with a free plan for side projects. react-i18next and i18next work fully without it.
What are similar projects?styled-components, formatjs, nuqs, luxon, hooks, zustand, taro, usehooks
Creator
i18next
Size
20.7 MB
Stars
10.1K
Updated
CommitOct 16
Age
10y
Commits · 90 Days