Localizing your application with QLinguist
Once you've marked your strings using tr
or qsTr
, you need to generate a table of those strings for Qt Linguist to localize. You can do this using the lupdate
command, which takes your .pro
file and walks your sources to look for strings to localize and creates an XML file of the strings you need to translate for Qt Linguist. You need to do this once for each language you want to support. When doing this, it's best to name the resulting files systematically; one way to do this is to use the name of the project file, followed by a dash, followed by the ISO-639-2 language code for the language.
A concrete example is in order. This chapter makes use of QtLinguistExample
; we can run lupdate
using a command such as this to create a list of strings that we'll translate to Esperanto (ISO-639-2 language code EPO):
% lupdate -pro .\QtLinguistExample.pro –ts .\QtLinguistExample-epo.ts
Don't forget that the %
character is the command prompt, which might differ...