[PyQt] Best project layout for translation?

Lee Harr missive at hotmail.com
Mon Mar 18 01:10:17 GMT 2013

I got a request to translate one of my PyQt projects. After
a few trips to Google I have a translation working!

(At least for the Qt-Designer-created forms...)

I created a .pro for my project like this:

SOURCES = lib/pynguin/pynguin.py \

FORMS = data/ui/pynguin.ui

TRANSLATIONS = data/translations/pynguin_es_ES.ts

I can run pylupdate4, open the .ts file with Qt Linguist,
and release the .qm file. Works great.

One problem:

If I store the translation file at the project root, when opened
with Qt Linguist it shows a nice preview of the form with the
translations filled in.

When I move the translations to data/translations/
Qt Linguist can no longer find the .ui file to show the nice
preview of the form.

Is there a standard project layout that will make this work?

Or a .pro directive that specifies a shared project root?

Also, once that preview has been closed, is there any way
to get it back again? I can't find the "Tools|Open/Refresh
Form Preview" mentioned in the manual.

I am using Qt Linguist 4.8.3 if that helps.

Thanks for any pointers.


More information about the PyQt mailing list