Merge branch 'fix-wxLocaleIdent-script-parsing' of https://github.com/utelle/wxWidgets

Fix script parsing in wxLocaleIdent.

See #22727.
This commit is contained in:
Vadim Zeitlin 2022-08-18 21:54:01 +02:00
commit 31885a81fc
2 changed files with 4 additions and 2 deletions

View file

@ -215,7 +215,7 @@ wxLocaleIdent wxLocaleIdent::FromTag(const wxString& tag)
case 4:
// Must be an ISO 15924 script.
locId.m_script = (*it).Left(1).Upper() + (*it).Mid(2).Lower();
locId.m_script = it->Capitalize();
break;
default:
@ -299,7 +299,7 @@ wxLocaleIdent& wxLocaleIdent::Script(const wxString& script)
script.find_first_not_of(validCharsAlpha) == wxString::npos)
{
// Capitalize first character
m_script = script.Left(1).Upper() + script.Mid(2).Lower();
m_script = script.Capitalize();
}
else if (!script.empty())
{

View file

@ -415,6 +415,8 @@ TEST_CASE("wxUILocale::FindLanguageInfo", "[uilocale]")
CheckFindLanguage("English", "en");
CheckFindLanguage("English_United States", "en_US");
CheckFindLanguage("English_United States.utf8", "en_US");
// Test tag that includes an explicit script
CheckFindLanguage("sr-Latn-RS", "sr_RS@latin");
}
// Test which can be used to check if the given locale tag is supported.