i18next documentation
🏠 i18next🌐 localization as a service🎓 i18next crash course💾 GitHub Repository
  • Introduction
  • Overview
    • Getting started
    • Comparison to others
    • API
    • Configuration Options
    • Supported Frameworks
    • Plugins and Utils
    • For Enterprises
    • First setup help
    • TypeScript
  • Translation Function
    • Essentials
    • Interpolation
    • Formatting
    • Plurals
    • Nesting
    • Context
    • Objects and Arrays
  • Principles
    • Best Practices
    • Translation Resolution
    • Namespaces
    • Fallback
    • Plugins
  • How to
    • Add or Load Translations
    • Extracting translations
    • Caching
    • Backend Fallback
    • FAQ
  • Misc
    • JSON Format
    • Creating own Plugins
    • Migration Guide
    • The history of i18next
    • Testimonials
  • 🌐localization as a service
  • 🎓i18next crash course
  • 💾GitHub Repository
Powered by GitBook
On this page
  • 1) Adding new strings manually
  • 2) Using an extraction tool
  • 3) Runtime extraction
  1. How to

Extracting translations

Last updated 2 years ago

At some point you will come to the question how to get new translation key/values into your namespace (translation) file.

1) Adding new strings manually

While for sure this is the least efficient method for adding new translations, we know a lot of projects are doing this. There is actually nothing wrong with it beside being some extra work developers could avoid.

2) Using an extraction tool

Static extraction tools can read through your code files to automatically find and export translation keys. , and are sensible choices to achieve this goal.

Or try , it shows an overview of your translations in a nice UI. Check which keys are not yet translated.

For more information about extraction tools, see documentation page.

3) Runtime extraction

I18next has a setting to send all keys that it was unable to resolve during runtime using the attached backend.

In case of the http-backend just set saveMissing: true on init:

import i18n from "i18next";
import detector from "i18next-browser-languagedetector";
import backend from "i18next-http-backend";
import { initReactI18next } from "react-i18next";

i18n
  .use(detector)
  .use(backend)
  .use(initReactI18next) // passes i18n down to react-i18next
  .init({
    fallbackLng: "en", // use en if detected lng is not available
    saveMissing: true // send not translated keys to endpoint
  });

export default i18n;

This is the most convenient way of working with react-i18next: just develop and run your applications without worrying too much about adding translations to your catalog as those get added automatically.

Check the for where missing translation gets sent.

Using node.js and express? You can get that endpoint for free: ​

Wanna have this process on steroids? Just hook up a localization project using the provided backend and get both the saveMissing and loading of translations automated in a true continuous localization process.

i18next-scanner
i18next-parser
babel-plugin-i18next-extract
translation-check
plugin and utils
options
https://github.com/i18next/i18next-http-middleware#add-routes
locize.com
Check out this tutorial!