Internalization

The process of translating keys is the heart of i18next, and as such this document should serve as a guide to the overall process by which i18next attempts to translate your keys into the appropriate content for a given location, be it on a specific page and/or for a user in a particular region of the world.

Setup

Here is how you can add you initial translation files to i18next.

1. Create a en.js or en.ts file with the following structure:

export const US = {
  app: "App Name",
  version: "US",
  about: "I'm using i18n translation system in English language",
}

2. Next we need to update our i18n configuration file from i18n.js file with the following structure:

// i18n.js
import i18next from "i18next";

// import the translation file/s
import * as en from "./en";

const i18n = i18next.createInstance();
i18n.init({
  lng: "en",
  fallbackLng: "en",
  ns: Object.keys(en.US),
});

export { i18n };
Previous
i18n support