Pull: Download Files
tx pull command lets you download translation files from Transifex for use.
To pull translations from Transifex, run the following command:
$ tx pull -a tx INFO: New translations found for the following languages:ru, fr, pt_BR, zh_CN tx INFO: Pulling translations for resource transifex_project.transifex_resource (source: None) tx WARNING: -> ru: translations/transifex_project.transifex_resource/ru.xlf tx WARNING: -> fr: translations/transifex_project.transifex_resource/fr.xlf tx WARNING: -> pt_BR: translations/transifex_project.transifex_resource/pt_BR.xlf tx WARNING: -> zh_CN: translations/transifex_project.transifex_resource/zh_CN.xlf tx INFO: Done.
Warning messages in the logs indicate that new versions of the translation files are pulled from Transifex and they will replace the ones you have locally stored.
Translation files are downloaded to the path you specified in the
.tx/config file. Your local translation files will be updated, and new files will be created if they don’t already exist locally. You’ll get one translation file per target language for each resource you’ve configured. By default, the downloaded files will have translation strings that are either translated or translated and reviewed.
The Client is set up in a way to try and preserve bandwidth as much as possible. It does so by default comparing the timestamps of your local translation files against the corresponding files on Transifex. If the local file's timestamp is more recent than the one on Transifex, the client will skip the download of that file. Another important reason why this is the default behavior is because your local files might contain information which you'll lose if they get overwritten. To override this behavior, use the
In case you want to compare the committed file's timestamp on Git repo against the timestamp of the corresponding file in Transifex then you can use the option
There are a few options available for the
tx pull command:
--all: Fetch all translation files from server, even ones which don’t exist already locally. If this option isn’t included, only the files that exist locally will be updated. If your pull command is skipping files, try to add this switch in combination with
--language: Specify which languages you want to pull translations for (defaults to all).
--resource: Specify the resource for which you want to pull the translations (defaults to all).
--source: Fetch the source file. If this option isn’t included, only the translation files are fetched.
--force: Force the download of the translations files regardless of whether timestamps on the local computer are newer than those on the server.
--use-git-timestamps: Pull resources/translations files by comparing the committed file's timestamp on Git repo against the timestamp of corresponding file in Transifex
--parallel: Pull multiple files from Transifex in parallel. By default, the client makes requests serially. Be careful when using this option with many files as it may cause you to hit your API rate limits.
--skip: Don't stop downloading when there’s an error. Useful when pulling many files and one of the requests fails for any reason.
--disable-overwrite: By default, Transifex will replace existing translation files with new ones when you pull. Use this flag if you want to disable this feature.
--minimum-perc=MINIMUM_PERC: Specify the minimum translation completion threshold required in order for a file to be downloaded.
--pseudo: Download a version of your file with pseudolocalization for testing.
--mode: Specify the mode or variant of the translation file you want. See the next section for the available modes.
--no-interactive: Don't require user input when forcing a pull.
--xliff: Download an XLIFF file (ending in
.xlf) along with the original file type.
--help: Show the help screen for the command.
Transifex can provide different variants of a translation file to match your needs. For example, you may only want to download reviewed strings. You can use the
--mode option with
tx pull to specify the variant you want:
$ tx pull --mode onlyreviewed
The supported modes are:
developer: The files downloaded will be compatible with the i18n support of the development framework you’re using. This is the default mode when you run
tx pull. Use this mode when you intend to use the file e.g. in production. This mode auto-fills empty translations with the source language text for most of the file formats we support, which is critical in the case of file formats that require all translations to be non-empty.
The default behavior of this mode is auto-filling empty translations with the source language text. However, file formats like YAML_GENERIC, YML (v=3) do not follow that rule so, any untranslated entries are returned empty.
When using this mode, pay attention not to upload your translations back into Transifex, because you might overwrite empty translations. Equivalent to the web app's option "Download file for use" (for_use*).
translator: The files will be suitable for offline translation. Equivalent to the web app's option "Download file to translate" (for_translation).
reviewed: The files will include reviewed strings in the translation language. All other strings will either be empty or in the source language depending on the file format.
onlytranslated: The files will include the translated strings. The untranslated ones will be left empty.
onlyreviewed: The files will only include reviewed strings. The rest of the strings will be returned empty regardless of if they’re translated or not.
Note: These two last modes above only apply to the following file formats: Apple strings, Chrome I18N, HTML, Java Properties, Joomla (ini), JSON Key-Value, Microsoft Word (alpha), Mozilla properties, Plain Text (txt), RequireJS format, and Windows JSON (resjson), GETTEXT (PO), YML (v=3).
sourceastranslation: The files will include the translated strings. The untranslated ones will be filled with the corresponding source strings.
Note: This mode is only supported for the following formats: Android, KEYVALUEJSON, PO, Properties (Java Properties), QT, SRT, Stringsdict, XLIFF, and YML.
In order to get a more detailed description about how each mode behaves for a particular file format, visit the links below depending on your file format.
- Android XML
- ChromeJSON (i18N)
- Apple StringsDict
- Github Mark-Down
- Adobe InDesign
- YAML Generic
- YAML Ruby on Rails
- The following command will only download a file that is 100% translated and 100% reviewed:
tx pull -a --mode reviewed
This is dependant on the following entry in the .tx/config file:
minimum_perc = 100
2. Consequently the following command will only download a file that is 100% translated and 100% reviewed, without requiring an entry in the tx-config file:
tx pull -a --mode reviewed --minimum-perc 100
In both cases the translation file will not download if the resource is 100% translated, but not 100% reviewed.
If you only want to pull translations for a subset of your resources, you can use the
--resource option to specify which resources to pull translations for. You can separate multiple resources with commas or wildcards to select multiple resources.
# identify a resource using project_slug.resource_slug $ tx pull -r transifex.core, video.srt $ tx pull -r 'transifex.co*'
Additionally, you can pull translations for specific (comma-separated) languages using the
$ tx pull -r transifex.core -l fr_FR, el_GR
If you pushed a branch-specific version of a source file to Transifex, you can pull the corresponding translation files by using
Be sure to either pull from the same branch you pushed from or specify the same branch name you used when pushing.
If you’re in a git repository, the client will pull translations into your current branch:
$ tx pull -a -b
If you’re using another version control system, you can pass a branch name you used previously when pushing:
$ tx pull -a -b branchname
When you pull a branch-specific file from Transifex:
- The translation files matching the branch are downloaded from Transifex to the path specified in your
- The translation files will keep the file name as specified in your
.tx/configfile. No branch information will be in the file name.