Solved Dialog standardButtons don't obey QLocale::setDefault()
-
Hi,
I have localized my app with linguist, following ```
ekke's great blog. As for now, I am manually setting the Locale in the main.cpp:QLocale curLocale(QLocale("fr_FR")); translationEnforced = true; QLocale::setDefault(curLocale);
Everything works fine, but the dialog's standardButtons are not in French, but in German (my OS's language). Is there a way to override this?
The Dialog is setup here (see screenshot below for result):
import QtQuick 2.9 import QtQuick.Controls 2.4 //... Dialog { id: resetDialog title: qsTr("Reset scores") Text { id: resetWarning text: qsTr("Warning: do you really want to reset all scores?") } standardButtons: Dialog.Yes + Dialog.No onAccepted: { Controller.resetScore() } }
Cheers, Sebastian
-
Hi,
Do you have that when running your application from Qt Creator ?
What version of Qt ?
What OS are you on ? -
Hi and thanks for answering!
That's a very interesting question. Yes, it happens on my desktop (Win10, 64bit), no matter if started by creator (Qt 11.2) or in a deployment folder. Funny: using it on my mobile (Android 9.0), my own stuff is still in the language I choose (like in the above screenshot), but the buttons are… English!I've meanwhile tried to find out, if adding one of Qt's translation files could do the trick, but I haven't had success yet. For starters, I don't know which of the many files would be appropriate.
Could it be possible that I am witnessing a "native" dialog that does not have any link at all to Qt's language setting?
-
You can see how it's done here
-
@sgaist, thank you!