Push: Upload Files
tx push command lets you push your files to Transifex.
When you run the
tx push command, you must specify whether you’re pushing source or translation files.
To push a source file, use the
--source flag with the
tx push command:
$ tx push -s
You must always include the
-s flag whether you’re pushing a source file for the first time or updating an existing source file. If you push a source file and there isn’t already a corresponding resource for it on Transifex, Transifex will create a new resource for it.
To push translation files, use the
--translations flag with the
$ tx push -t
You can also combine the two flags to push source and translation files together:
$ tx push -s -t
There are additional options available for the
tx push command:
--language: Specify which languages you want to push translations for (defaults to all).
--resource: Specify the resource for which you want to push the translations (defaults to all).
--force: Push source files without checking modification times.
--use-git-timestamps: Push resources/translations files by comparing the committed file's timestamp on Git repo against the timestamp of the corresponding file in Transifex
--parallel: Push multiple files to 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 on errors. Useful when pushing many files concurrently.
--no-interactive: Don't require user input when forcing a push.
--xliff: Upload XLIFF versions of your translation files. The XLIFF files are expected to be found alongside the original translation files, with the same name followed by a .xlf extension. Let's say your file is under
translations/<lang>/trans.po. If you add the
--xliffargument to the push command, the client will search for
translations/<lang>/trans.po.xlf. If it finds the file, it will upload it to Transifex.
--help: Show the help screen for the command.
Pushing XLIFF files through the client using
--xliff is only supported on the Premium plan and up.
By default, Transifex will try to guess when the pushed files are not changed and it will skip those. To force the push operation, you should use the
Depending on your team’s translation workflow, you may want translations to start before a feature branch is merged into the mainline branch to ensure translations are done by the time you’re ready to deploy.
To push a branch-specific version of a file to Transifex, use
If you’re in a git repository, the client will detect and use the name of your current branch to name the resource:
$ tx push -s -b
If you’re using another version control system or your files are not being version controlled, you can pass a branch name that will be used to name the new resource:
$ tx push -s -b branchname
tx push -b doesn’t switch branches, i.e. checkout to a different branch. It only renames a resource in a way that makes it easily identifiable later in Transifex.
When you push a branch-specific file to Transifex, the following happens:
- The source file in its current state is pushed to Transifex as a new resource.
- This new resource will have the branch name prepended to the corresponding resource slug configured in your
.tx/config. For example,
.tx/config file has multiple source files configured, a branch-specific version of each source file will be created.
When pushing source files, Transifex will update the source strings of a resource to match those from the new source file. This may result in the loss of information, so please pay extra attention when pushing a source file. This is why you always need to include
--source when running
Here's how Transifex handles differences between the old and new source files:
- New strings are added.
- Modified strings are considered new ones and added as well.
- Strings that aren't in the new source file – including ones which have been modified – are removed from Transifex. However, your old translations are kept in the Translation Memory of your project.
More information on how source strings are handled can be found here.