PySide Internationalization

From Qt Wiki
Revision as of 16:23, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

English 日本語

Internationalizing PySide programs

You will need to make a project file first:
kalam.pro

The two files in TRANSLATIONS will create two files for both languages (UK English and Esperanto here).

Now run:

Now you have your translation files ready to be used with Qt Linguist per this tutorial. [doc.qt.nokia.com] Load the .ts file, double click entries and type the translation, click the ? icon to mark them as finished then do File -> Release to compile a new .qm file. The translator uses the .qm files.

Adding translation support to your application is trivially easy:
Will load the Esperanto translations.

Every QObject has a function called tr which returns the translated string. pyside-lupdate which we ran above, simply scans your sourcecode to find all instances where it’s called.

Categories: