[PyQt] Clarification requested on pylupdate5 input and .ts files

David Cortesi davecortesi at gmail.com
Thu May 1 21:50:08 BST 2014

The pylupdate5 docs [1] do not make clear what inputs are essential in
order to get .ts files out.

Does it require calls to translate() to be grouped in a retranslateUi()
method as created by Designer output?

And/or does it look for calls to translate() by a particular name?

I am writing an app that I expect to have translated, not using Designer
for  most widgets, and began writing code like this:

>  _TR = QCoreApplication.translate
> ...
>       (chosen_path, _) = QFileDialog.getOpenFileName(self,
>              _TR("EditViewWidget",
>                     "Choose a file of OCR error words to mark",
>                    "File dialog caption"), ... )

In other words, giving translate() a different name, and casually embedding
calls to it at the point where a literal string is used. Then I thought,
hold on, will pylupdate be able to see that?

What is the expected or best practice for coding strings for translation?

Dave Cortesi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140501/a58627eb/attachment.html>

More information about the PyQt mailing list