<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Le 08/11/10 22:27, Mikael Modin a écrit :
<blockquote
cite="mid:AANLkTiktW1em=VMw6PSW9gVwn+gy9P38NDj7GehOQmQ8@mail.gmail.com"
type="cite">
<pre wrap="">Hi,
I'm trying to translate a UI created using QDesigner, but I could
never get it working so I wrote a quick minimal non-working sample in
the hope that one of you could tell me what I'm doing wrong.
---------------------------- main.py
----------------------------------------------
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class Wnd(QDialog):
def __init__(self):
QDialog.__init__(self)
self.setWindowTitle(self.tr("Title"))
def main():
app = QApplication(sys.argv)
translator = QTranslator()
translator.load("main.ts")
app.installTranslator(translator)
wnd = Wnd()
wnd.show()
app.exec_()
if __name__ == '__main__':
main()
------------------------------- main.ts
-------------------------------------------
The translation file I created using "pyuldate4 main.py -ts main.ts"
and then edited in QLinguist.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="sv_SE" sourcelanguage="en_GB">
<context>
<name>Wnd</name>
<message>
<location filename="main.py" line="8"/>
<source>Title</source>
<translatorcomment>Blabla</translatorcomment>
<translation>Muffins</translation>
</message>
</context>
</TS>
Kind regards,
Mikael Modin
_______________________________________________
PyQt mailing list <a class="moz-txt-link-abbreviated" href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<a class="moz-txt-link-freetext" href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a>
</pre>
</blockquote>
Hi,<br>
<br>
Use .qm instead .ts, in QLinguist : menu Files >> Release<br>
<br>
and change the line 13 in main.py<br>
<br>
<pre wrap=""> translator.load("main") # No extension</pre>
<br>
<br>
<div class="moz-signature">-- <br>
Vincent V.V.<br>
<a href="https://launchpad.net/oqapy">Oqapy</a></div>
</body>
</html>