[PyQt] Re: [Eric] Linguist question

Detlev Offenbach detlev at die-offenbachs.de
Sat Oct 3 15:44:14 BST 2009


Hi,

first I should clarify, that lupdate-qt4 does not deal with Python sources. 
That's the job of pylupdate4. The later will extract the translatable strings 
from Python sources (*.py) and form files (*.ui). If called from eric4 
(through the context menu of the translations tab of the project viewer) a 
temporary .pro file is generated by eric4 containing just the file entries 
appropriate for the selected action (current file, all selected files or all 
files of the project). More explanations below.

On Samstag, 3. Oktober 2009, Michele Petrazzo - Unipex wrote:
> (since I think that it's a pyqt question/problem I cc to pyqt ml)
>
> Detlev Offenbach wrote:
> >> Hi,
>
> Hi,
> I think that I'm finally going crazy with the qt linguistic...
> I just update pyqt to 4.5.4 and qt 4.5.2 (the last on debian unstable
> repo) for see if was the file version the problem but it's the same...
>
> >> Tried and it work, but not completely: the process forgot the various
> >> self.trUtf8 inside the code. Is there a method for include also those?
> >
> > It should include the source files as well as long as the are part of the
> > project. Make sure, you add all your sources.
>
> I have all the sources into into the project, but pylupdate "forgot"
> some translations. My debug tests was modifying eric for using
> pylupdate4 or lupdate and see the different output (-r3462
> Project/ProjectTranslationsBrowser.py::906 )
>
> pylupdate4 show me some errors that lupdate not show. something like
> "gui/main.py:419: Unterminated string" and on that line I have """Emit
> the signal on selection""", so I think that it's right since I have a
> lot of other docstring around the same code that aren't warned. The same
> problems are shown on other files around the project.

That is strange. I would need the sources to analyze it.

>
> The ending output was:
> pylupdate4: Updating 'gui/i18n/main_it.ts'...
> pylupdate4:     Found 40 source texts (3 new and 37 already existing)
> pylupdate4:     Removed 10 obsolete entries
> pylupdate4:     Same-text heuristic provided 3 translations
>
> It seen only 3 of the 10 trUtf8 call, but put them on the right
> "context", so behind the right "python class"
>
> After, opening the .ts file with linguist-qt4 (dclick on eric) on the
> "source and forms" space, I see only the error
> "trunk/gui/i18n/gui/Ui_main.py not available", but I have no file there
> since I have them on trunk/gui/Ui_main.py

You may ignore this. It just means, that linguist cannot show the source for 
the file being translated. It seems, that linguist gets confused, if the 
translation file (.ts) is not in the root directory of the project.

>
> lupdate-qt4 show me some errors that pylupdate4 not recognize and some
> other coincide, with different error message "Unterminated C++ string".
> The output was:
> lupdate-qt4: Updating 'gui/i18n/main_it.ts'...
> lupdate-qt4:
> lupdate-qt4:     Found 47 source text(s) (10 new and 37 already existing)
> lupdate-qt4:     Removed 3 obsolete entries
> lupdate-qt4:     Same-text heuristic provided 3 translation(s)
>
> Opening the .ts file with linguist-qt4 now I see *all* my translations,
> but with "wrong" context called <unnamed context>.
> The other strange thing it's that on the "source and frames" now I see
> both my gui and my code when I select the translations on "unnamed
> context".

Please send the .ts file generated by lupdate-qt4 for analysis.

>
> On the other hand, both pylupdate4 and lupdate-qt4 analyze and found the
> strings on the .ui file correctly, so the differences are only for the
> non-gui strings.
>
> The last differences that I saw it's that when I "execute" my code for
> see the strings, all that translated with lupdate-qt4 (into the unnamed
> context) aren't translated into the execution, but that three that
> pylupdate4 saw yes...

That is to be expected due to the missing context.

>
> This is the end...
> Hope that I explain correctly my problem and, of course, if you need the
> complete sources, I'll send all.
>
> Thanks,
> Michele
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


Regards,
Detlev
-- 
Detlev Offenbach
detlev at die-offenbachs.de


More information about the PyQt mailing list