Transifex

  • Documentation
  • CLI Client
  • Push: Upload Files

Push: Upload Files

The tx push command lets you push your files to Transifex.

Pushing 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 -s or --source flag with the 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 -t or --translations flag with the push command:

$ tx push -t

You can also combine the two flags to push source and translation files together:

$ tx push -s -t

Additional command options

There are additional options available for the tx push command:

  • -l or --language: Specify which languages you want to push translations for (defaults to all).
  • -r or --resource: Specify the resource for which you want to push the translations (defaults to all).
  • -f or --force: Push source files without checking modification times.
  • --skip: Don't stop on errors. Useful when pushing many files concurrently.
  • --no-interactive: Don't require user input when forcing a push.
  • -x or --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 --xliff argument 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.
  • -h or --help: Show the help screen for the command.

Note

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

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 --force option.

Pushing branch-specific files

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 -b or --branch with tx push.

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

Note

Running 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.

What happens when you push branch-specific files

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, branchname--myresource.

If your .tx/config file has multiple source files configured, a branch-specific version of each source file will be created.

Tip

If you push multiple branch-specific files to Transifex, it’s likely that the files will have a lot of similarity between them. To avoid having to retranslate each file from scratch, we recommend enabling Translation Memory Autofill and TM sharing.

How source string updates are handled

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 -s or --source when running tx push.

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.