Translation¶
Setup¶
Install this package with command-line tools, install the Transifex Client, and install sphinx-intl
:
pip install sphinx-intl
Create new translations¶
Create a project on Transifex (in this example, our project’s identifier is ocds-extensions
).
Generate POT files for all versions of all extensions:
ocdsextensionregistry generate-pot-files build/locale
Or, generate POT files for only live versions of extensions:
ocdsextensionregistry generate-pot-files --no-frozen build/locale
Or, generate POT files for the versions of extensions you want to translate, for example:
ocdsextensionregistry generate-pot-files build/locale lots bids==v1.1.4
Remove any existing .tx/config
file:
rm -f .tx/config
Create a new .tx/config
file:
sphinx-intl create-txconfig
Update the .tx/config
file based on the POT files (replace open-contracting-partnership-1
with your organization and ocds-extensions
with your project):
sphinx-intl update-txconfig-resources --transifex-organization-name open-contracting-partnership-1 --transifex-project-name ocds-extensions --pot-dir build/locale --locale-dir locale
Push source files to Transifex for translation:
tx push -s
Once you’ve translated strings on Transifex, email data@open-contracting.org so that we can pull translation files from Transifex, build MO files, and commit the changes:
tx pull -f -a
sphinx-intl build -d locale
Update existing translations¶
Existing translations are stored in ocds-extensions-translations.
Follow the steps for creating new translations, then clone the repository:
git clone https://github.com/open-contracting/ocds-extensions-translations.git
Change into its directory:
cd ocds-extensions-translations
And push its translations. See Transifex’s documentation for more information on how to specify which languages or resources to push:
tx push -t
Once you’ve translated strings on Transifex, follow the same final step under creating new translations.