Solved How to detect the current language on Windows (I need the Qt way)
-
According with this post,
https://stackoverflow.com/questions/18594380/qlocale-detects-system-language-incorrectly-on-windows-with-language-pack-instal?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
the line of code
QLocale::system().name()
returns the value pointed from the red arrow. I need to have back the value of the green arrow.
Which is the right Qt way?
-
Hi,
Do you mean both the name and the country name ?
-
No, I need only the selected language.
For example I need "it" when italian language is selected, "en" when english language is selected. -
Then maybe, QLocale::uiLanguages is what you are looking for.
Or just check what a default constructed
QLocale
object returns. -
Ok, I try
-
Sorry but I was wrong. The green arrow indicates the keyboard layout, not the current language. So
QLocale::system().name()
is right. -
So everything is working as expected ?
-
Yes it is
-
Then please mark the thread as solved :)