Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

QLocale detects system language incorrectly on Windows with language pack installed

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?

like image 821
Violet Giraffe Avatar asked Oct 30 '25 01:10

Violet Giraffe


1 Answers

When I was working on Localization in Qt, I used

QString locale = QLocale::system().name();

When I tested getting the locale, I found it was dependent on the Format in the Region and Language settings:

Control Panel > Region and Language > Format

Windows Region and Language Format Setting (german)

Hope that helps.

like image 77
phyatt Avatar answered Nov 01 '25 17:11

phyatt



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!