Unsolved QML Filedialog Translation
-
Hi, I am using QtQuick to develop a small MS Windows application that allows dynamic translation, e.g. en, fr, de.
In translation, it is fine with the custom .qml files with the .ts. However, when using FileDialog, no matter how I installed the QTranslator with the qt_.qm, qtbase_.qm ...etc. it is not translated. The UI is translated but the FileDialog does not. I have to change the system locale and reboot the machine and QTranslator is not necessary at this time.I tried to use QFileDialog (the QtWidget), the content can be changed with the QTranslator with qt_*.qm files.
Is it a bug in Qt ?
My setup:
-Qt 5.14
-Windows 10
-MSVC 2017main.cpp
... QString locale = "fr";// QLocale::system().name(); QTranslator translator; if ( translator.load(QString("qt_") + locale)){ app.installTranslator(&translator); }else{ return -1; } QTranslator qtBaseTranslator; if (qtBaseTranslator.load("qtbase_" + locale)){ app.installTranslator(&qtBaseTranslator); }else{ return -1; } ...
main.qml
import QtQuick 2.14 import QtQuick.Window 2.14 import QtQuick.Controls 2.13 import QtGraphicalEffects 1.0 import QtQuick.Dialogs 1.3 Window { id: window visible: true width: 1280 height: 720 color: "yellow" title: qsTr("Hello World!") ... FileDialog { id: fileDialog title: qsTr("Please choose a file") folder: shortcuts.desktop selectMultiple: true nameFilters: ["All (*)"] onAccepted: { console.log("GG") } onRejected: { console.log("gg") } } ...