The application can be easily be translated into other languages. Here's how we handle those translations.
The main project file takes care of generating .qm
files from the source .ts
files. It is mostly automated.
This resource file must be updated whenever a new translation is added. Please note that files must end with .qm
, not .ts
.
<qresource prefix="/i18n">
<file alias="BeTrains.en.qm">i18n/BeTrains.en.qm</file>
<file alias="BeTrains.nl.qm">i18n/BeTrains.nl.qm</file>
</qresource>
This directory contains all translations. Filenames must adhere to this format:
BeTrains.xx_YY.ts or BeTrains.xx.ts
i18n/BeTrains.en.ts
is a treated in a special way. It is used as the source for all other translations. Whenever a string in the code is change this file must be updated to reflect those changes. Usually, this can be accomplished by running lupdate
, after which the file can get pushed to Transifex (see below).
We are using http://transifex.net as a frontend for translating the client, use the "transifex client":http://help.transifex.net/features/client/index.html to fetch new translations from transifex.
lupdate -no-obsolete -pro BeTrains.pro -ts i18n/BeTrains.en.ts
- Fill in plural forms (use Qt Linquist, or manually edit
numerus="yes"
entries) tx push -s
tx pull -a
- Update
BeTrains.qrc
git add
new translations fromi18n/