Learn how to generate multi-language images in seconds with Bannerly!See Bannerly.io

CLI: More options

Last modified: January 05, 2022Author: Jakub Pomykała

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

Use configuration file

Create simplelocalize.yaml file

apiKey: API_KEY

# Upload command
uploadPath: ./src
uploadFormat: multi-language-json
uploadOptions: MULTI_FILE
ignorePaths:
  - './ignore/*/regex/*'
  - './ignore/directory'

# Download command
downloadPath: ./src
downloadFormat: multi-language-json
downloadOptions: MULTI_FILE

languageKey: en

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

Ignore directories and files

Multi-file mode allows you to upload translation files from multiple locations. With ignorePaths property you can exclude unwanted files from being uploaded.

ignorePaths:
    - "./ignore"
    - "./ignore/*/pattern/*"
    - "./ignore/file/*.json"
    - "./node_modules"

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. Script will go through all files from 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