QFileDialog QTranslator
-
Relatively new to QT for Python I am wondering if there is a way to get a QFileDialog in German language on MacOS.
With
app = QApplication(sys.argv)
qt = QTranslator()
print(qt.load("qtbase_de", QLibraryInfo.location(QLibraryInfo.LibraryPath.TranslationsPath))
app.installTranslator(qt)I get "True" printed. So, I think the German qm-file is loaded successfully. Unfortunately the buttons (Open, Cancel, New Folder) and all the labels are still in English.
Thanks for any help!
-
Relatively new to QT for Python I am wondering if there is a way to get a QFileDialog in German language on MacOS.
With
app = QApplication(sys.argv)
qt = QTranslator()
print(qt.load("qtbase_de", QLibraryInfo.location(QLibraryInfo.LibraryPath.TranslationsPath))
app.installTranslator(qt)I get "True" printed. So, I think the German qm-file is loaded successfully. Unfortunately the buttons (Open, Cancel, New Folder) and all the labels are still in English.
Thanks for any help!
Hi and welcome to devnet,
Is your OS configured for German ?
By default, Qt uses the native file dialog so it will likely be show in the system language.
-
Hi and welcome to devnet,
Is your OS configured for German ?
By default, Qt uses the native file dialog so it will likely be show in the system language.
Yes, it is.
I noticed three things in the meantime:
First, running the app leads to the following Warning:
DeprecationWarning: Function: 'QLibraryInfo.location(QLibraryInfo.LibraryPath location)' is marked as deprecated, please check the documentation for more information.
directory = QLibraryInfo.location(QLibraryInfo.LibraryPath.TranslationsPath)Secondly, print(Locale.system().name() outputs en_DE (I expected de_DE).
Thirdly, curiously the application menu (Services, Hide Python, Hide Others...) IS translated to German! QTranslator seems to work generally, but does not affect QFileDialog.
-
Yes, it is.
I noticed three things in the meantime:
First, running the app leads to the following Warning:
DeprecationWarning: Function: 'QLibraryInfo.location(QLibraryInfo.LibraryPath location)' is marked as deprecated, please check the documentation for more information.
directory = QLibraryInfo.location(QLibraryInfo.LibraryPath.TranslationsPath)Secondly, print(Locale.system().name() outputs en_DE (I expected de_DE).
Thirdly, curiously the application menu (Services, Hide Python, Hide Others...) IS translated to German! QTranslator seems to work generally, but does not affect QFileDialog.