summaryrefslogtreecommitdiff
path: root/platform/windows
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2020-07-25 23:42:11 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2020-08-11 13:19:19 +0300
commitf797e1c0782a477cc8c0e9997aa5add6172ea9a0 (patch)
treec2d7271837d957ba84e29616ef65b8920c98665b /platform/windows
parentf2d6a4bf84c2a5c11a5bebd7ebc09f0c7fdfd9f0 (diff)
Improve `OS::get_locale()` on macOS and Windows, replace "-" with "_" and use system macros instead of bitwise AND. Add locale format info to the documentation.
Diffstat (limited to 'platform/windows')
-rw-r--r--platform/windows/os_windows.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 5b15896b0c..a3e23a9053 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -567,21 +567,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";
}