Command |
Action |
wti add path/to/master/file.po |
Upload a new master language file |
wti add file1.po file2.po file3.xml |
Create several master language files at once, by specifying each file |
wti add *.po |
Create several master language files at once, by specifying an extension |
find . -name "*en.yml" | xargs wti add |
Find all the en.yml files and add them to the project |
wti push |
Update a master language file |
wti push -l fr |
Update a target (French) language file |
wti push -l "fr en da sv" |
Update several target language files at once (French, English, Danish, Swedish) |
wti push --all |
Update all language files at once |
wti push path/to/file.yml |
Pushes the path/to/file.yml file |
wti pull |
Download target language files |
wti pull -l fr |
Download a specific language file (French) |
wti pull --all |
Download all language files, including source |
wti pull path/to/files/* |
Download all files in path/to/files |
wti pull path/to/files/* -l fr |
Download all fr files in path/to/files |
wti pull --force |
Force pull (to bypass WebTranslateIt’s HTTP caching) |
wti addlocale fr |
Add a new locale to the project |
wti addlocale fr da sv |
Add several locales at once |
wti status |
View project statistics |
wti match |
Show matching between files on local computer and the ones in WebTranslateIt’s File Manager |
## Hooks
It is sometimes useful to hook a command or a script before or after a push or a pull. One use-case would be to launch a build after pulling language files. You can do that by implementing hooks in your `.wti` file.
There are 4 hooks:
* `before_pull`
* `after_pull`
* `before_push`
* `after_push`
Check the [sample `.wti`](https://github.com/AtelierConvivialite/webtranslateit/blob/master/examples/.wti#L9..L13) file for implementation.
## Exit codes
Since version 1.4.0 `wti` returns exit codes on failure. The exit code is `0` if the command executed successfully and `1` if the command executed but encountered at least one error. This is useful to act upon errors if you use `wti` to pull files in an automated build process.
``` zsh
~/code/webtranslateit.com[master]% wti pull
# Pulling files on WebTranslateIt
config/locales/translation_validator/en.yml | e82e044..e82e044 Skipped
config/locales/app/en.yml | f2ca86c..f2ca86c Skipped
config/locales/defaults/en.yml | 2fcb61f..2fcb61f Skipped
config/locales/js/en.yml | ee6589d..ee6589d Skipped
config/locales/js/fr.yml | 2f8bb0e..2f8bb0e Skipped
config/locales/translation_validator/fr.yml | 534af2c..534af2c Skipped
config/locales/app/fr.yml | 29f8c9d..da39a3e OK
config/locales/defaults/fr.yml | aca123e..aca123e Skipped
Pulled 8 files at 7 files/sec, using 3 threads.
~/code/webtranslateit.com[master]% echo $?
0
~/code/webtranslateit.com[master]% wti pull
# Pulling files on WebTranslateIt
config/locales/translation_validator/en.yml | e82e044..e82e044 Error
config/locales/app/en.yml | f2ca86c..f2ca86c Skipped
config/locales/defaults/fr.yml | aca123e..aca123e Skipped
Pulled 3 files at 3 files/sec, using 3 threads.
~/code/webtranslateit.com[master]% echo $?
1
```
Since version 2.4.1 the `wti status` command also returns meaningful codes. It will exit with `0` if the project is 100% translated and proofread, `100` if the project is not 100% translated and `101` if the project is not 100% proofread. This could allow you to check if a project is 100% translated or completed before deploying a project.
``` zsh
~/Desktop/test% wti status
# Gathering information on test ts
fr: 40% translated, 40% completed.
en: 90% translated, 0% completed.
~/Desktop/test% echo $?
100
~/Desktop/test% wti status
# Gathering information on test ts
en: 100% translated, 0% completed.
fr: 100% translated, 100% completed.
~/Desktop/test% echo $?
101
~/Desktop/test% wti status
# Gathering information on test ts
en: 100% translated, 100% completed.
fr: 100% translated, 100% completed.
~/Desktop/test% echo $?
0
```
# License
Copyright (c) 2009-2019 WebTranslateIt Software S.L, released under the MIT License.