(Return to primary ../README.md.)
To upload/download translation files to/from Transifex, you'll need an account
there with access to these translations. Then follow the Authentication -
Transifex API v3: to get an API token, and set
TRANSIFEX["API_TOKEN"] in your environment with its value.
The creativecommons/cc-legal-tools-data repository must be cloned
next to this cc-legal-tools-app repository. (It can be elsewhere, then you
need to set DATA_REPOSITORY_DIR to its location.) Be sure to clone using a
URL that starts with git@github... and not https://github..., or you won't
be able to push to it. See ../README.md for details.
In production, the check_for_translation_updates management command should
be run hourly. See Check for Translation
Updates, below.
Also see Publishing changes to git repo, below.
Babel is used for localization information.
Documentation:
Django Translation uses two sets of Gettext Files in the creativecommons/cc-legal-tools-data repository (the Data Repository, above). See that repository for detailed information and definitions.
Documentation:
- Translation | Django documentation | Django
- Transifex API
- Add language to appropriate resource in Transifex
- Ensure language is present in Django
- If not, update
cc_legal_tools/settings/base.py
- If not, update
- Add objects for new language translation using the
add_translationmanagement command.- Examples:
./bin/manage.sh add_translation -v2 --licenses -l tlh
./bin/manage.sh add_translation -v2 --zero -l tlh
- Examples:
- Synchronize repository Gettext files with Transifex
- Compile
.momachine object Gettext files:./bin/manage.sh compilemessages
Documentation:
- Quick start guide — polib documentation
- Also see How the tool translation is implemented documentation, above
- TODO document processes of synchronizing the repository Gettext files
with Transifex, including the following management commands:
locale_infonormalize_translationscompare_translationspull_translationpush_translationcompilemessages
⚠️ This functionality is currently disabled.
The hourly run of check_for_translation_updates looks to see if any of the
translation files in Transifex have newer last modification times than we know
about. It performs the following process (which can also be done manually:
Ensure the Data Repository (../README.md) is in placeWithin the creativecommons/cc-legal-tools-data (the Data Repository):Checkout or create the appropriate branch.For example, if a French translation file for BY 4.0 has changed, the branch name will becc4-fr.
Download the updated.poportable object Gettext file from TransifexDo the Translation Update Process (below)This is important and easy to forget, but without it, Django will keep using the old translations
Commit that change and push it upstream.3.~~ Within thiscc-legal-tools-apprepository:~~For each branch that has been updated, Generate Static Files (../README.md). Use the options to update git and push the changes.
Documentation: