Bug 1859752 - Part 11: Add workarounds for ICU bugs. r=platform-i18n-reviewers,dminor

The fix for <https://unicode-org.atlassian.net/browse/ICU-22547> only handled four
character long language subtags, but language subtags with more than four
characters are still handled incorrectly.

Depends on D192735

Differential Revision: https://phabricator.services.mozilla.com/D192736
This commit is contained in:
André Bargull 2023-11-07 08:45:50 +00:00
parent 3967539454
commit 43d5add4d4

View File

@ -745,6 +745,15 @@ enum class LikelySubtags : bool { Add, Remove };
// Return true iff the locale is already maximized resp. minimized.
static bool HasLikelySubtags(LikelySubtags aLikelySubtags, const Locale& aTag) {
// ICU/CLDR doesn't have any likely subtags data for locales whose language
// subtag has more than three characters, so we can return early here.
//
// This early return also avoids hitting the following ICU bug:
// https://unicode-org.atlassian.net/browse/ICU-22547
if (aTag.Language().Length() > 3) {
return true;
}
// The locale is already maximized if the language, script, and region
// subtags are present and no placeholder subtags ("und", "Zzzz", "ZZ") are
// used.