Fix parsing Windows sort order in wxLocaleIdent::FromTag()

Adjust the code to check for Windows sort order only after the last
underscore (instead of the first one).

This avoids misinterpreting locale tags like "zh_Hans_CN".
This commit is contained in:
utelle 2023-05-25 14:01:09 +02:00 committed by Vadim Zeitlin
parent 5a80bfb1e9
commit 9ada6cd2db

View file

@ -159,8 +159,11 @@ wxLocaleIdent wxLocaleIdent::FromTag(const wxString& tag)
//
// Make sure we don't extract the region identifier erroneously as a sortorder identifier
{
wxString tagTemp = tagMain.BeforeFirst('_', &tagRest);
if (tagRest.length() > 4 && locId.m_modifier.empty() && locId.m_charset.empty())
wxString tagTemp = tagMain.BeforeLast('_', &tagRest);
if (!tagTemp.empty() &&
tagRest.length() > 4 &&
locId.m_modifier.empty() &&
locId.m_charset.empty())
{
// Windows sortorder found
locId.SortOrder(tagRest);