Skip to content
Edouard edited this page Mar 9, 2022 · 6 revisions

See Readme for general information.

Autofetch

Autofetch is a technique to systematically check for an updated language file with Web Translate It for each page requested. This is useful on a staging site for letting the translation team test their translations in context. However this is not recommended on production.

Configuration File

The configuration file is named .wti and is located at the root of your project directory. (If you’re using a version of wti prior to 1.8.2.0, the configuration file was named config/translation.yml).

Sample file:

# Required - The Project API Token from WebTranslateIt.com
# More information: https://github.com/webtranslateit/webtranslateit/wiki#configuration-file

api_key: SECRET

# Optional - Locales not to sync with WebTranslateIt.
# Takes a string, a symbol, or an array of string or symbol.

# ignore_locales: [en]

# Optional - Locales to sync with WebTranslateIt.
# Takes a string, a symbol, or an array of string or symbol.

# needed_locales: [en, fr, it]

# Optional - Files not to sync with WebTranslateIt.
# Takes an array of globs.

# ignore_files: ['**/fr.yml', 'config/locales/js/*.yml', 'config/locales/app/fr.yml']

# Optional - Hooks
# Takes a string containing a command to run.

# before_pull: "echo 'some unix command'"   # Command executed before pulling files
# after_pull:  "touch tmp/restart.txt"      # Command executed after pulling files

# before_push: "echo 'some unix command'"   # Command executed before pushing files
# after_push:  "touch tmp/restart.txt"      # Command executed after pushing files

Hooks

If the command in a hook is not successful (if returns the a status code that is not 0), the hook aborts the script. For example if you run wti pull with a .wti file containing before_pull: "exit 1", the wti pull command won’t be executed because the before_pull command was not successful.