There are two options to support translating ADR:
- Using adx_develop helpers to deal with all ADR extensions at once
- Manually by interacting with a single extension
adx_develop repo includes a utility script to help translate all extension repos quickly and easily. It should be used as follows:
-
Check that the list of extensions to be translated, and the list of languages they should be translated into, is complete in at the top of the translate.sh script. The script should be located at:
adx_develop/translate.sh. -
Ensure you have latest development branch checked out everywhere. You can use
adx forallto create translation branches in all neseccary repos quickly E.g. (if not using submodules):adx forall ckanext-unaids ckanext-restricted ckanext-scheming ckanext-validation ckanext-ytp-request ckanext-emailasusername ckanext-pages ckanext-dhis2harvester ckanext-harvest ckanext-blob-storage ckanext-versions -c git checkout -b ADX-789-translations
-
If using submodules, use:
git submodule foreach 'git checkout -b ADX-789-translations' -
Update all the message catalogs and copy the resulting .po files into a single directory using the command:
adx bash ckan /usr/lib/adx/adx_develop/translate.sh update_catalogs
-
If using submodules:
/usr/lib/adx/translate.sh update_catalogs
-
Select all the language folders in
/adx_develop/build/translations/containing po files and zip them up to send to the translator. You probably want to useadx forall(similar to step 2) at this point to commit and push the updated message catalogs to github. -
Once you have the translated po files back from the translator, ensure you copy them back to the
/adx_develop/build/translations/folder exactly as you found them at the end of step 3. -
Run the following command to copy all files back to their original location.
adx bash ckan /usr/lib/adx/adx_develop/translate.sh copy_translations
-
Check that the files have been properly copied across.
adx status
-
Compile all translations with the following command:
adx bash ckan /usr/lib/adx/adx_develop/translate.sh compile_catalogs
Check no error messages appear in the logs.
-
Review the site in the local dev env to check formatting.
-
Use an
adx forallcommand to commit and push all updated translations to github quickly. You'll then need to manually open PRs for each repo.
If you have a local working ADR venv you can skip steps 0, 1 (using python env from ckan container) and 5 (change file access).
In brief:
-
SSH into the ckan container
adx bash ckan source ../../bin/activate cd /usr/lib/adx/ckanext-extension-name/
-
Generate the
.potfile to extract the strings from your extensionadx bash ckan cd /usr/lib/ckan/venv/ source bin/activate cd /usr/lib/adx/submodules/ckanext-unaids
-
Generate the
.potfile to extract the strings from your extensionpython setup.py extract_messages
-
If there is no
.poalready set up, init it:python setup.py init_catalog --locale fr python setup.py init_catalog --locale pt_PT
-
If there is a
.po, update it:python setup.py update_catalog --locale fr python setup.py update_catalog --locale pt_PT
-
Give yourself edit-access to the
.po/.mofiles:chmod -R 777 /usr/lib/adx/submodules/ckanext-unaids/ckanext/unaids/i18n/
-
Make updates to the
.pofiles -
Compile the
.pofiles into the.mofilespython setup.py compile_catalog
-
Restart the ckan container to see the changes