Transifex

  • Documentation
  • CLI Client
  • Pull: Download Files

Pull: Download Files

The tx pull command lets you download translation files from Transifex for use.

Pulling files

To pull translations from Transifex, run the following command:

$ tx pull -a

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 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 -f switch.

Command options

There are a few options available for the tx pull command:

  • -a or --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 -f.
  • -l or --language: Specify which languages you want to pull translations for (defaults to all).
  • -r or --resource: Specify the resource for which you want to pull the translations (defaults to all).
  • -s or --source: Fetch the source file. If this option isn’t included, only the translation files are fetched. 
  • -f or --force: Force the download of the translations files and use timestamps to skip updating local files.
  • --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.
  • -x or --xliff: Download an XLIFF file (ending in .xlf) along with the original file type. 
  • -h or --help: Show the help screen for the command.

Note

Pulling XLIFF files through the client using --xliff is only supported on the Enterprise plan.

Getting different file variants

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. 

Note

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.

Note

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.

Pulling specific sets of translation files

If you only want to pull translations for a subset of your resources, you can use the -r or --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 -l or --language option.

$ tx pull -r transifex.core -l fr_FR, el_GR

Pulling branch-specific translation files

If you pushed a branch-specific version of a source file to Transifex, you can pull the corresponding translation files by using -b or --branch with tx pull.

Note

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

What happens when you pull branch-specific files

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 .tx/config file.
  • The translation files will keep the file name as specified in your .tx/config file. No branch information will be in the file name.