Transifex

  • Documentation
  • Django SDK
  • Migrating an existing Django app

Migrating an existing Django app

Note

You can start using Transifex Native by creating a Transifex Native project.

Django SDK has built-in functions to help developers migrate existing Django apps from Django i18n to Native using the following command line utils:

./manage.py transifex migrate --review=file --mark=string-low --save=replace --path myapp/templates/

Migration script will parse the files and convert them to Native format, for example replace {% trans %} to {% t %} blocks etc.

For migration options use the help command:

./manage.py transifex migrate --help

usage: manage.py transifex migrate [-h] [--file FILES] [--path PATH]
                                   [--text TEXT] [--save SAVE_POLICY]
                                   [--review REVIEW_POLICY]
                                   [--mark MARK_POLICY]
optional arguments:
  -h, --help            show this help message and exit
  --file FILES, -f FILES
                        The relative paths of the files to migrate. Separate
                        multiple paths with commas, or use -f multiple times.
  --path PATH, -p PATH  The path of the files to migrate. Finds files
                        recursively.
  --text TEXT, -t TEXT  If set, the migration command will display the result
                        of converting the given text to Transifex Native
                        syntax, and then exit.
  --save SAVE_POLICY    Determines where the migrated content will be saved: -
                        "new": migrated content will be saved in a new file,
                        named <filename>__native.<extension> - "none": no
                        changes will be saved - "backup": migrated content
                        will be saved directly in the original file path, and
                        a backup will also be saved in
                        <filename>.<extension>.bak - "replace": migrated
                        content will be saved in the original file
  --review REVIEW_POLICY
                        Determines where the migrated content will be saved: -
                        "string-low": you get a chance to review each string
                        that has a low migration confidence - "none":
                        everything will be done automatically without having a
                        chance to review anything - "string": you get a chance
                        to review each string of each file before the file is
                        saved - "file": you get a chance to review each
                        migrated file before it is saved - "file-low": you get
                        a chance to review each migrated file that includes at
                        least one string that has a low migration confidence
  --mark MARK_POLICY    Determines if anything gets marked for proofreading: -
                        "string-low": any migrated string that has low
                        confidence will be marked for proofreading - "none":
                        nothing will automatically be marked for proofreading
                        - "file-low": any migrated file that includes at least
                        one string that has low migration confidence will be
                        marked for proofreading