CLI: More options

Last modified: March 16, 2022Author: Jakub Pomykała

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

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:
  - INCLUDE_NAMESPACE

# 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
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.

Configuration profiles

If you would like to use simplelocalize.yml from custom location or with custom name like simplelocalize-dev.yml file, you can achieve that easily by passing path as the first argument.

$ simplelocalize --config /tmp/simplelocalize-dev.yml [command] --apiKey YOUR_API_KEY