Translations Directory

The po directory holds files related to translations of the application into different languages. It also contains files that help the build system keep the translations up to date.

Name Purpose
treasure.pot POT file containing the translatable strings for the application.
meson.build The build file for the po directory.
POTFILES Contains a list of files to scan for translatable strings.
LINGUAS Contains a list of language codes corresponding to the PO files that should be processed for use in the application.
en_GB.po A sample PO translation file for British English.

The treasure.pot file is a Portable Object Template (POT) file that contains the user-visible strings for the application. Strings are obtained from the files listed in the POTFILES file, which includes source and UI files:

src/main.py
src/ui/menus.ui
src/ui/window.ui

Translations of the strings are stored as message catalogs in Portable Object (PO) files for each language. These files are compiled to Machine Object (MO) files by the build system if the languages they represent are listed in the LINGUAS file. For example, the en_GB.po file will be processed because it is listed as en_GB in the LINGUAS file:

en_GB
nb

The treasure.pot file is generated when the meson-treasure-pot build rule is run:

ninja -C _build meson-treasure-pot

Run this rule whenever you update the application with new user-visible strings that will need to be translated. Then run the meson-treasure-update-po rule to update the PO files:

ninja -C _build meson-treasure-update-po

The strings in each PO file can then be checked and translated to the appropriate language. When the application is built these are automatically compiled to MO files. When the application is installed these are copied to the appropriate directories on the system.