Module to assist with transifex integration. Works with Silverstripe 4.12+ and 5.0+.
- Pull latest translations from transifex and merge them into yml/json/js translation files
- Run i18nTextCollectorTask on a local website (optional)
- Push updated source strings to transifex (optional)
- Create github pull-requests with file changes
Transifex cli client (tx) - https://developers.transifex.com/docs/cli configured API key from transifex.
You must use the go version at least version 1.6+ and not the old python version.
Create a new classic github api token in github token settings with all checkboxes unticked except for public_repo
. This is required to create pull-requests.
Delete this token from github once you have completed updating translations.
cd /path/to/my-local-site
composer require silverstripe/tx-translator
To pull latest translations from transifex, typically this will be done on the lowest supported branch:
TX_GITHUB_API_TOKEN=mytoken php vendor/silverstripe/tx-translator/scripts/translate.php
To run text collector and update transifex with the latest source strings, typically this will be done on the latest next-minor branch:
TX_GITHUB_API_TOKEN=mytoken TX_SITE=my-local-site.test TX_COLLECT=1 TX_PULL=0 TX_PUSH=1 php vendor/silverstripe/tx-translator/scripts/translate.php
Environment variables can either be set via the command line, like in the examples above, or in an .env in the root folder of the site, or using any other methods to set environment variables.
Note that the valid values for the boolean variables are 1, true, on, 0, false and off.
TX_GITHUB_API_TOKEN
(required) - the github token with write access to create pull-requestsTX_PULL
(default1
) - pull latest translations from transifex, run i18nTextCollectorTask and update translation filesTX_PUSH
(default0
) - push new source strings to transifexTX_COLLECT
(default0
) - run i18nTextCollectorTask on local siteTX_SITE
(required ifTX_COLLECT
is1
) - the url of a local silverstripe site to run i18nTextCollectorTask against.http://
will be automatically added if protocol is omittedTX_DEV_MODE
(default0
) - do not push to transifex or create github pull-requests. Useful for local development and for doing dry-runsTX_VERBOSE_LOGGING
(default0
) - show verbose logging