[PyKDE] QTranslator not working at all?

Andreas Pakulat apaku at gmx.de
Thu Jun 29 10:22:00 BST 2006


On 29.06.06 11:04:49, Andreas Pakulat wrote:
> Hi,
> 
> I've got a small problem here with QTranslator: It doesn't work.
> 
> I attached the .ts and .qm files for reference, with those the following
> code snippet returns an empty string:
> 
> >>> from PyQt4 import QtCore
> >>> app=QtCore.QCoreApplication()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: insufficient number of arguments to QCoreApplication()
> >>> import sys
> >>> import os
> >>> app=QtCore.QCoreApplication(sys.argv)
> >>> qtrans = QtCore.QTranslator()
> >>> qtrans.load("xpathevaluator_de", os.getcwd() )
> True
> >>> qtrans.translate('BasicModel','Node')
> <PyQt4.QtCore.QString object at 0xb7c7f4ec>
> >>> print "'%s'" %qtrans.translate('BasicModel','Node')
> ''
> 
> Anybody got ideas? However the i18n example works perfectly..

As you can see in the ts-file some program (I don't know which it might
have been) added the obsolete type to all strings. While I'm not getting
the correct string from the above script (the translation for Node), it
doesn't work in the real application. I think that is due to the
context-problem and I will look into that later. If I can't find a
solution I'll be back ;-)

Andreas

-- 
Your lucky color has faded.




More information about the PyQt mailing list