CLI: Extract keys

Last updated: April 16, 2022Author: Jakub Pomykała

Extract translation keys from your project files. Choose projectType and invoke extract command. The CLI will upload found translation keys to the translation editor. The CLI will process your local files for a given path in searchDir parameter and find all translation keys. Every found translation key will be added to the translation editor.

Usage

Before you start, you need to install the CLI. Follow the installation guide.

simplelocalize extract \
  --apiKey PROJECT_API_KEY \
  --projectType yahoo/react-intl \
  --searchDir ./src

Supported libraries

Libraries from which you can extract translation keys

LibraryprojectType value
react-intlyahoo/react-intl
Standard Android internationalizationgoogle/android
Standard iOS internationalizationapple/ios-macos
react-i18nexti18next/i18next
mde/ejsmde/ejs

How message extraction works?

For example, to translate frontend application in ReactJS, you can use 3rd party library like yahoo/react-intl:

Example yahoo/react-intl usage in React app code:

<FormattedMessage id="LOGIN"/>

Translation key LOGIN will be found by localization CLI tool.

simplelocalize extract --apiKey API_KEY --projectType PROJECT_TYPE --searchDir ./src

After running the command above, the CLI will upload found translation keys to the translation editor.