Translations are managed in Transifex. Each CKAN extensions has its own resource in Transifex and in addition, wordpress has a single resource which covers all of the wordpress translations.

Translations from codebase to Transifex and back are handled via .po files which are uploaded and downloaded with the help of Transifex client.


Translations for CKAN consist of translations of extensions and translations of the CKAN itself. If the translation shown on UI does not exist in projects transifex resources, it comes from CKAN core translations. If someone wishes to change the translation, he needs to add translated key to the extension, where it overrides the core translation. If multiple extensions have the same translated key in their .po files, all need to have the same translation.

Generating translation files

Translations in CKAN extensions mostly follow the official documentation. In summary, following commands should cover most of the cases.

// Activate virtual environment
. /usr/lib/ckan/default/bin/activate

// Run rest of commands for single extension 
cd /vagrant/ckanext/ckanext-sixodp/

// Extract messages for extension
python extract_messages

Translating in Transifex

The newly generated translation files can be uploaded and downloaded to transifex with the following commands:

// Upload to transifex
tx push -s

// After translated in transifex, download the translated files
tx pull

Compiling translations

Translation files can be compiled by running following commands:

// Activate virtual environment
. /usr/lib/ckan/default/bin/activate

// Run rest of commands for single extension 
cd /vagrant/ckanext/ckanext-sixodp/

// Compile translation files
python compile_catalog -f


Generating translations for WordPress is done manually with makepot.php. Translation tools in wp-cli cannot be used as the version is use is too old for them and it cannot be updated until automating polylang is replaced with something as polylang-cli was abandoned. makepot.php assumes specific folder structure and following commands should generate translation files.

// Run in vagrant home /home/vagrant
cp -r /vagrant/sixodp/ sixodp
cp -r /opt/wordpress/ src
cd sixodp/tools/
php makepot.php wp-theme ../ /vagrant/sixodp/i18n/sixodp.pot

After being pushed and pulled from Transifex, following commands will compile the translations files:

msgfmt /vagrant/sixodp/i18n/en_GB/LC_MESSAGES/sixodp.po -o /vagrant/sixodp/i18n/en_GB/LC_MESSAGES/
msgfmt /vagrant/sixodp/i18n/fi/LC_MESSAGES/sixodp.po -o /vagrant/sixodp/i18n/fi/LC_MESSAGES/
msgfmt /vagrant/sixodp/i18n/sv/LC_MESSAGES/sixodp.po -o /vagrant/sixodp/i18n/sv/LC_MESSAGES/

Other notes

There are some tools which may or may not work in for CKAN and in for WordPress.

Last updated