[PyQt] Fwd: translation of ui
Sebastian Wiesner
lunaryorn at googlemail.com
Fri Jul 1 10:17:30 BST 2011
2011/7/1 Yaşar Arabacı <yasar11732 at gmail.com>:
> Thanks, appearantly I also needed to create a .pro file for pylupdate to
> know which files to convert to.
Alternatively you can specifiy the files to translate and the
translations to update on the command line:
pylupdate4 <ui_files> <python_files> -ts <translation_files>
> I created a language file and translated it, but how would my application use that translation file?
Use "lrelease" from Qt [1] to compile the translations, and deploy the
compiled translations along with your program. In your program you
need to create a "QTranslator" [2] to load these compiled
translations. There a different ways of deploying the translations
(e.g. as distutils package data), but the easiest is probably to
include them as resource (using "pyrcc4").
You should read the "Qt Linguist" manual [3], which describes the Qt
translation process in detail, and the corresponding chapter in the
PyQt Reference Guide [4], which describes the PyQt specific
differences to this process.
[1] http://doc.qt.nokia.com/latest/linguist-manager.html#lrelease
[2] http://doc.qt.nokia.com/latest/qtranslator.html#details
[3] http://doc.qt.nokia.com/latest/linguist-manual.html
[4] http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/i18n.html
More information about the PyQt
mailing list