Uploading source content to Transifex

After the strings have been marked either inside templates or in Python code (for example in Views), you can push them to Transifex.

In order to be able to do so, first make sure your Transifex project secret is in your Django settings file, as described in the setup section, and then simply run:

./manage.py transifex push 

This command works in two phases:

  • First, it goes through all the files of the current directory (and subdirectories) and collects all translatable strings in memory
  • Then, it contacts Transifex and pushes the strings with all the metadata to the project (and resource) that is associated with the token you have given during setup

This way, the source strings reach Transifex and become available for translation.

Explore more advanced options using the command line help:

./manage.py transifex push --help

usage: manage.py transifex push [-h] [--extension EXTENSIONS] [--purge]
                                [--append-tags APPEND_TAGS]
                                [--with-tags-only WITH_TAGS_ONLY]
                                [--without-tags-only WITHOUT_TAGS_ONLY] [--dry-run]
                                [--no-wait] [--override-tags] [--do-not-keep-translations]
                                [--verbose] [--symlinks] [--key-generator {source,hash}]

optional arguments:
  -h, --help            show this help message and exit
  --extension EXTENSIONS, -e EXTENSIONS
                        The file extension(s) to examine (default: "html,txt,py", or "js"
                        if the domain is "djangojs"). Separate multiple extensions with
                        commas, or use -e multiple times.
  --purge, -p           Replace the entire resource content with the pushed content of this
                        request. If not provided (the default), then append the source
                        content of this request to the existing resource content.
  --append-tags APPEND_TAGS
                        Append tags to strings when pushing to Transifex
  --with-tags-only WITH_TAGS_ONLY
                        Push only strings that contain specific tags
  --without-tags-only WITHOUT_TAGS_ONLY
                        Push only strings that do not contain specific tags
  --dry-run             Do not push to CDS
  --no-wait             Disable polling for upload results
  --override-tags       Override tags when pushing content
  --do-not-keep-translations
                        Remove translations when source strings change
  --verbose, -v         Verbose output
  --symlinks, -s        Follows symlinks to directories when examining source code and
                        templates for translation strings.
  --key-generator {source,hash}
                        Use "hash" or "source" based keys (default: source)