I am attempting to detect current system language with QLocale
:
QLocale::Language sysLangId = QLocale::system().language();
However, it's not working correctly. I'm on Russian Windows 7 with English language pack applied, but language()
returns Russian instead of English. Is there any workaround?
I've found 2 ways to solve my problem. The Qt way is to use
QLocale::system().uiLanguages()
. On my system it returns a list with a single item "en-US". The problem with that is I need a language name, like "english", so I'd have to add a map for converting language code to language name. It's no big deal, but I've decided to use WinAPI: