Fix #134599: Win32 Automatically Detect Language for Chinese Variations

On the Windows platform if you select "Automatic" for language, it
won't actually select correctly for the Chinese languages. This is
because our Windows code returns a locale like ""zh_CN" or "zh_TW",
not the "zh_HANS" and "zh_HANT" expected. This PR checks for language
code "zh" and will then will append "_HANT" if your 2-letter region
is TW (Taiwan), HK (Hong Kong), or MO (Macau), and "_HANS" for other
regions (like China, Malaysia, Singapore, etc).

Pull Request: https://projects.blender.org/blender/blender/pulls/140027
This commit is contained in:
Harley Acheson
2025-06-09 18:00:16 +02:00
committed by Harley Acheson
parent 675438d331
commit 7c013f9ea8

View File

@@ -111,8 +111,20 @@ class Info {
if (GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, sizeof(buf)) != 0) {
locale_name = buf;
if (GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf, sizeof(buf)) != 0) {
locale_name += "_";
locale_name += buf;
std::string region = buf;
if (locale_name == "zh") {
if (region == "TW" || region == "HK" || region == "MO") {
/* Traditional for Taiwan, Hong Kong, Macau. */
locale_name += "_HANT";
}
else {
/* Simplified for all other areas. */
locale_name += "_HANS";
}
}
else {
locale_name += "_" + region;
}
}
}
}