Merge pull request #40708 from bruvzg/improve_os_locale

Improve `OS::get_locale()` and documentation.
This commit is contained in:
Rémi Verschelde
2020-12-10 11:49:00 +01:00
committed by GitHub
3 changed files with 11 additions and 6 deletions

View File

@ -561,21 +561,21 @@ String OS_Windows::get_locale() const {
LANGID langid = GetUserDefaultUILanguage();
String neutral;
int lang = langid & ((1 << 9) - 1);
int sublang = langid & ~((1 << 9) - 1);
int lang = PRIMARYLANGID(langid);
int sublang = SUBLANGID(langid);
while (wl->locale) {
if (wl->main_lang == lang && wl->sublang == SUBLANG_NEUTRAL)
neutral = wl->locale;
if (lang == wl->main_lang && sublang == wl->sublang)
return wl->locale;
return String(wl->locale).replace("-", "_");
wl++;
}
if (neutral != "")
return neutral;
return String(neutral).replace("-", "_");
return "en";
}