Install requirements:
pip install -r requirements.txtInstall gettext and translate-toolkit for the manage.py add-and-remove command. With Homebrew:
brew install gettext translate-toolkitInstall python-Levenshtein to silence warning from translate-toolkit (WARNING:root:Python-Levenshtein not found. Continuing with built-in (slower) fuzzy matching.):
eval $(brew --prefix translate-toolkit)/libexec/bin/python -m pip install python-Levenshtein-
Generate POT files for live versions of registered extensions:
./manage.py extract
-
Update the configuration file of the translation tool.
This occurs automatically when using
--transifex-organizationand--transifex-projectwith theextractcommand.For Crowdin, use
manage.pyfrom data-support:path/to/manage.py update-crowdinyml-files -p build/locale -d locale --ignore v1
-
Push the source strings to the translation tool.
This occurs automatically when using
--transifex-organizationand--transifex-projectwith theextractcommand.
WARNING:
Generate POT files, then:
-
Pull translated strings from the translation tool.
WARNING: Changes made to PO files outside Transifex will be lost.
This occurs automatically when using
--transifex-organizationand--transifex-projectwith thepretranslatecommand. -
Pretranslate translatable strings for live versions of registered extensions:
WARNING: If different resources translate the same string in different ways, the translated strings will change to that of the last alphabetically sorted extension.
./manage.py pretranslate
-
Push translated strings to the translation tool.
This occurs automatically when using
--transifex-organizationand--transifex-projectwith thepretranslatecommand.
-
Add and remove the extensions:
./manage.py add-and-remove
-
Update the configuration file of the translation tool, as above.
-
Push the source strings and translated strings to the translation tool.
This occurs automatically when using
--transifex-organizationand--transifex-projectwith theextractcommand.
crowdin pull translationsOr:
tx pull -w 20 -f -aThen:
sphinx-intl build -d localeNote: This section has not yet been added to manage.py. These commands are in fish.
Set environment variables as appropriate (using the fish shell):
set old_version v1.1.3
set new_version v1.1.4
set new_version_underscored v1_1_4Generate POT files for the new versions of core extensions:
ocdsextensionregistry generate-pot-files build/locale bids==$new_version enquiries==$new_version location==$new_version lots==$new_version milestone_documents==$new_version participation_fee==$new_version process_title==$new_versionPre-populate the PO files:
for extension in bids enquiries location lots milestone_documents participation_fee process_title
for lang in (ls locale)
mkdir -p locale/$lang/LC_MESSAGES/$extension/$new_version
for domain in docs schema codelists
if [ -f locale/$lang/LC_MESSAGES/$extension/$old_version/$domain.po ]
pretranslate --nofuzzymatching -t locale/$lang/LC_MESSAGES/$extension/$old_version/$domain.po build/locale/$extension/$new_version/$domain.pot locale/$lang/LC_MESSAGES/$extension/$new_version/$domain.po
end
end
end
endUpdate the .tx/config file:
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 the new source files:
for i in (grep $new_version_underscored .tx/config | tr -d '[]')
tx push -s $i
endPush the pre-populated translation files:
for i in (grep $new_version_underscored .tx/config | tr -d '[]')
tx push -f -t $i
endYou can exclude from the translation tool any extensions whose source strings haven't changed in many years.
-
Update local repositories:
./manage.py git-pull path/to/directory/of/extensions
-
Find stale extensions:
./manage.py stale path/to/directory/of/extensions 3
You can now delete these extensions from the translation tool, if the account is near its limits.
Note: At present, when using --transifex-organization and --transifex-project, manage.py extract will re-add these extensions to Transifex.
Change the two paths below, and change .po to .pot if appropriate:
cd path/to/locale/es
for i in **.po; do
msgcmp $i relative/path/to/another/locale/es/$i
done