From 3dfe253d3cf7f8e1bfba6b2cdb3f53628aa224df Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 6 Feb 2023 21:31:16 +0100 Subject: [PATCH] Fix GetSystemLocale() return value for "C" locale This was broken by the recent changes, so fix it again: we do still want to return wxLANGUAGE_ENGLISH_US for this particular locale. --- src/common/uilocale.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/uilocale.cpp b/src/common/uilocale.cpp index 49de63fcdc..cc50184bc5 100644 --- a/src/common/uilocale.cpp +++ b/src/common/uilocale.cpp @@ -693,10 +693,14 @@ int wxUILocale::GetSystemLocale() // fallback on the language, which is something that it generally makes // sense for FindLanguageInfo() to do, but in this case we really need the // locale. - if ( defaultLanguage && - locId.GetTag(wxLOCALE_TAGTYPE_BCP47) == defaultLanguage->LocaleTag ) + if ( defaultLanguage ) { - return defaultLanguage->Language; + // We have to handle the "C" locale specially as its name is different + // from the "en-US" tag found for it, but we do still want to return + // English for it. + const wxString tag = locId.GetTag(wxLOCALE_TAGTYPE_BCP47); + if ( tag == defaultLanguage->LocaleTag || IsDefaultCLocale(tag) ) + return defaultLanguage->Language; } return wxLANGUAGE_UNKNOWN;