From 7c013f9ea8d05351cf0806e77cc9b6e547d28871 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Mon, 9 Jun 2025 18:00:16 +0200 Subject: [PATCH] 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 --- .../blender/blentranslation/intern/messages.cc | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/source/blender/blentranslation/intern/messages.cc b/source/blender/blentranslation/intern/messages.cc index 2e71c5f4d70..3bf63066271 100644 --- a/source/blender/blentranslation/intern/messages.cc +++ b/source/blender/blentranslation/intern/messages.cc @@ -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; + } } } }