[PyQt] Clarification requested on pylupdate5 input and .ts files
Phil Thompson
phil at riverbankcomputing.com
Thu May 1 22:10:06 BST 2014
On 01/05/2014 9:50 pm, David Cortesi wrote:
> 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?
It looks for tr() (and trUtf8()?). It's on the TODO list to be able to
pass a command line flag to specify the name of additional names.
Phil
More information about the PyQt
mailing list