[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] Another translation question
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2006-06-29 22:49:15
Message-ID: 20060629224915.GA24473 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]

On 30.06.06 00:24:10, Andreas Pakulat wrote:
> just had a look at generated code from pyuic4 and I'm curious:
> 
> Shouldn't pyuic4 use
> QtCore.QCoreApplication.translate(classname.objectName(), <somestring>)
> in retranslateUi(self, classname)?

Turns out it already does by redefining self.tr, however it's not
completely right, because it uses self.uiname, which is the objectName
of the class created.

The attached classes uses self.toplevelWidget.uiclass for the context
parameter. This makes translation of generated python code working and
by this "workaround" you can translate ui-forms.

Andreas

-- 
Never reveal your best argument.


--- PyQt-x11-gpl-4.0/pyuic/uic/Compiler/compiler.py	2006-06-10 14:43:21.000000000 +0200
+++ PyQt-x11-gpl-4.0.fixpyuic4/pyuic/uic/Compiler/compiler.py	2006-06-30 00:46:11.000000000 +0200
@@ -54,7 +54,7 @@
 \treturn QtGui.QApplication.translate("%s", string, None, QtGui.QApplication.UnicodeUTF8)
 
 def retranslateUi(self, %s):
-""" % (self.translator.split(".")[-1], self.uiname, self.uiname))
+""" % (self.translator.split(".")[-1], self.toplevelWidget.uiclass, self.uiname))
         indenter.indent()
         indenter.write("\n".join(qtproxies.i18n_strings))
         indenter.dedent()


_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic