I have used static linking to qt_de only in my example. In my real code I am using the systems locale and I have the same problem with other languages as well. All Qt translations are working fine except when using any of 'getOpenFileName', 'getSaveFileName' and 'getExistingDirectory' with QFileDialog which are always displayed in English. With 'DontUseNativeDialog' option enabled they are translated correctly. I can live with this problem if this is happening only our my development machines.
2010/6/25 Mark Summerfield <[email protected]>: > On 2010-06-25, Eugen wrote: >> I have some problems with translations of QFileDialog. In the example >> below "dlg2" appears in English on my Windows XP development machine, >> the rest in German. "dlg1" looks like a Qt custom dialog and "dlg2" >> like the windows standard file dialog but with an old icon theme. On >> other computers I have tested this (Ubuntu, Windows 7 and 2000) all >> dialogs are in german. How can I get more information about what file >> dialog Qt is using here and also what kind of theme is used there? >> >> import sys >> from PyQt4.QtCore import * >> from PyQt4.QtGui import * >> >> app = QApplication(sys.argv) >> >> qtTranslator = QTranslator() >> if qtTranslator.load("qt_de", >> > QLibraryInfo.location(QLibraryInfo.TranslationsPath)): >> app.installTranslator(qtTranslator) >> >> dlg1 = QFileDialog(None, "Dialog 1", ".", "All files (*.*)") >> dlg1.open() >> dlg2 = QFileDialog.getOpenFileName(None, "Dialog 2", ".", "All files >> (*.*)") dlg3 = QMessageBox.question(None, >> "Dialog 3", >> "Frage?", >> QMessageBox.Yes|QMessageBox.No| >> QMessageBox.Cancel) >> >> sys.exit(app.exec_()) > > Hi Eugen, > > The rule of thumb is that Qt uses the native file dialog where one is > available. As for the English vs. German Qt will respect the machine's > locale unless you override it as you're doing here. So maybe you don't > have the qt_de.qm file on your XP machine? > > You can tell Qt not to use native dialogs: > > http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qfiledialog.html#Option- > enum > > > -- > Mark Summerfield, Qtrac Ltd, www.qtrac.eu > C++, Python, Qt, PyQt - training and consultancy > "Advanced Qt Programming" - ISBN 0321635906 > http://www.qtrac.eu/aqpbook.html > > I ordered a Dell netbook with Ubuntu... > I got no OS, no apology, no solution, & no refund (so far) > http://www.qtrac.eu/dont-buy-dell.html > -- There are 10 kinds of people. Those who understand binary notation, and those who do not. _______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
