CLI: More options

Last updated: October 17, 2022Author: Jakub Pomykała

Learn more what other options you can set up in SimpleLocalize CLI.

This documentation page has been deprecated. Please use the new CLI documentation and do not follow the instructions below unless you know what you are doing.

Configuration file

Use a configuration file to simplify your bash command. Arguments used in command always overrides properties set in configuration file.

Sample simplelocalize.yaml file

# Project API Key
apiKey: API_KEY

# Properties used by 'upload' command
uploadPath: ./src/{lang}/{ns}.json
uploadFormat: single-language-json
uploadOptions:
  - REPLACE_TRANSLATION_IF_FOUND

# Properties used by 'download' command
downloadPath: ./src/{ns}/messages_{lang}.json
downloadFormat: single-language-json
downloadOptions:
  - WRITE_NESTED

# Properties used by 'extract' command
searchDir: ./src # Windows: .\src
projectType: yahoo/react-intl
ignoreKeys:
  - 'WELCOME'
  - 'ABOUT-US'

Custom configuration file path

To use custom configuration file, you can use -c <PATH> or --config <PATH> parameter.

Example

simpleloclize --config ./path/to/config.yaml [COMMAND]

Please note that configuration parameter comes before COMMAND!

Ignore translation keys

apiKey: <API_KEY>
projectType: <PROJECT_TYPE>
ignoreKeys:
    - "HEY"
    - "PLEASE"
    - "DO NOT IGNORE ME"
    - ":("

Note: Ignore keys feature is only available though configuration file.

Custom search directory

If you would like to search translation keys in some specific path, you can achieve this by adding searchDir property, and the path where CLI should search for the keys.

apiKey: <API_KEY>
projectType: <YOUR_PROJECT_TYPE>
searchDir: ./my-project

Please pay attention to what you are putting in the 'searchDir' property. The script will go through all files from the given path to find the keys - giving a root path may cause high CPU and disc usage.