Menu

#155 Locale selection on Windows8+ from new WinAPI

v1.0 (example)
open
nobody
None
5
2021-06-06
2021-06-06
OCTAGRAM
No

Windows 8 introduced a list of locales in the settings, as opposed to single language, like it was before. The Windows settings page tells that applications pick the first available locale from the list. However, applications using the outdated GetLocaleInfoW WinAPI get something else, something ridiculous, something that is adjusted via well hidden setting "Codepage for non-Unicode programs", which I had set up to be ANSI=UTF-8 mode long ago, so I had no idea I should ever be visiting it again.

In practice, as seen on screenshot, I have set up locale priority RU, EN, CN. I have set up Windows system GUI to be Russian one. And most of applications were in Russian. But some ones, like Wireshark and HeidiSQL were picking the least preferred locale, the Chinese one, in my case. Now I understand that it can also be a locale not from the list at all, a completely different locale, if somebody changed "Codepage for non-Unicode programs" and forgot about it, since we almost get rid of non-Unicode programs nowadays.

I propose using the new Windows.System.UserProfile.GlobalizationPreferences.Languages WinAPI. It is returning what is really a real list, and it is possible to pick a locale from it according to Windows settings label, the first supported one.

Maybe not the first one! Why not. If somebody has a list of FR, DE, then program can pick DE, as opposed to undesired EN, not even on the list, like gettext does now, when only aware of single preferred locale.

1 Attachments

Discussion


Log in to post a comment.