What you’ll need #️⃣

This guide uses react-i18next or LinguiJS. react-i18next uses JSON. LinguiJS uses PO by default.

Before you start, make sure you have:

  • One of these libraries installed and configured in your project
  • Localazy CLI installed
  • Strings already externalized into translation files

Set up the Localazy configuration file #️⃣

Create a localazy.json file in your project root. Use the block for your library.

react-i18next #️⃣

{
  "writeKey": "your-write-key",
  "readKey": "your-read-key",
  "upload": {
    "type": "json",
    "files": "public/locales/en/*.json",
    "features": ["plural_postfix_us"]
  },
  "download": {
    "files": "public/locales/${lang}/${file}"
  }
}

This configuration uploads all namespace files. Each namespace stays in its own file after download.

Plurals. i18next uses key suffixes for plurals, for example items_one and items_other. The plural_postfix_us feature reads these suffixes as plural forms. Localazy writes the correct suffixes for each target language. For example, Czech gets items_one, items_few, and items_other.

If your project uses the older i18next JSON format with key_plural or numbered suffixes (key_0, key_1), use plural_i18next instead.

If you use the i18next ICU plugin (i18next-icu), use plural_icu instead. Localazy converts only one ICU plural in each string. The supported forms are zero, one, two, few, many, and other.

LinguiJS #️⃣

{
  "writeKey": "your-write-key",
  "readKey": "your-read-key",
  "upload": {
    "type": "po",
    "files": "src/locales/en/messages.po"
  },
  "download": {
    "files": "src/locales/${lang}/messages.po"
  }
}

Run lingui extract before you upload, and run lingui compile after you download.

Plurals. Lingui writes ICU plurals into the message text. With PO files, the ICU expression stays in the string and translators edit it as one text. To get a separate field for each plural form, set Lingui to use @lingui/format-json with the minimal style. Then use "type": "json" with "features": ["plural_icu"] and change the file extensions to .json. Localazy converts only one ICU plural in each string. The supported forms are zero, one, two, few, many, and other.

Replace the keys with your actual keys from your Localazy project settings.

Upload source files #️⃣

localazy upload

This command sends your source language files to Localazy.

Download translated files #️⃣

localazy download

This command writes one translated file for each language into the paths from the download section.

Next steps #️⃣

  • Translate your strings in Localazy, then run localazy download to get the translations.
  • Read the format documentation: JSON and PO. The JSON page lists all plural features.
  • If you found an error in the guide, or have problems with the integration, contact us at team@localazy.com.