<br>Hi, me again :)<br><br>I got it working but wanted to get an affimation, what do you think of this approach?<br><br>if __name__ == "__main__":<br> from locale import getlocale<br> from os.path import exists<br>
app = QtGui.QApplication(sys.argv)<br> if getlocale()[0]:<br> if exists("translations/" + getlocale()[0] + ".qm"):<br> translator = QtCore.QTranslator(app)<br> translator.load(getlocale()[0] + ".qm", "translations")<br>
app.installTranslator(translator)<br> window = MainWindow()<br> window.show()<br> sys.exit(app.exec_())<br><div class="gmail_quote">01 Temmuz 2011 12:37 tarihinde Yaşar Arabacı <span dir="ltr"><<a href="mailto:yasar11732@gmail.com">yasar11732@gmail.com</a>></span> yazdı:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">That works like a charm thanks :)<br><br><br><div class="gmail_quote">01 Temmuz 2011 12:17 tarihinde Sebastian Wiesner <span dir="ltr"><<a href="mailto:lunaryorn@googlemail.com" target="_blank">lunaryorn@googlemail.com</a>></span> yazdı:<div>
<div></div><div class="h5"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>2011/7/1 Yaşar Arabacı <<a href="mailto:yasar11732@gmail.com" target="_blank">yasar11732@gmail.com</a>>:<br>
</div><div>> Thanks, appearantly I also needed to create a .pro file for pylupdate to<br>
> know which files to convert to.<br>
<br>
</div>Alternatively you can specifiy the files to translate and the<br>
translations to update on the command line:<br>
<br>
pylupdate4 <ui_files> <python_files> -ts <translation_files><br>
<div><br>
> I created a language file and translated it, but how would my application use that translation file?<br>
<br>
</div>Use "lrelease" from Qt [1] to compile the translations, and deploy the<br>
compiled translations along with your program. In your program you<br>
need to create a "QTranslator" [2] to load these compiled<br>
translations. There a different ways of deploying the translations<br>
(e.g. as distutils package data), but the easiest is probably to<br>
include them as resource (using "pyrcc4").<br>
<br>
You should read the "Qt Linguist" manual [3], which describes the Qt<br>
translation process in detail, and the corresponding chapter in the<br>
PyQt Reference Guide [4], which describes the PyQt specific<br>
differences to this process.<br>
<br>
[1] <a href="http://doc.qt.nokia.com/latest/linguist-manager.html#lrelease" target="_blank">http://doc.qt.nokia.com/latest/linguist-manager.html#lrelease</a><br>
[2] <a href="http://doc.qt.nokia.com/latest/qtranslator.html#details" target="_blank">http://doc.qt.nokia.com/latest/qtranslator.html#details</a><br>
[3] <a href="http://doc.qt.nokia.com/latest/linguist-manual.html" target="_blank">http://doc.qt.nokia.com/latest/linguist-manual.html</a><br>
[4] <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/i18n.html" target="_blank">http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/i18n.html</a><br>
</blockquote></div></div></div><br>
</blockquote></div><br>