mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
Bug 1618034 - Strip private subtags in nsLanguageAtomService::GetUncachedLanguageGroup so that we can parse the standard subtags and use the proper font prefs. r=zbraniecki
Differential Revision: https://phabricator.services.mozilla.com/D72050
This commit is contained in:
parent
d0d3827cd2
commit
db407a2c45
@ -170,7 +170,19 @@ nsStaticAtom* nsLanguageAtomService::GetUncachedLanguageGroup(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// If the lang code can be parsed as BCP47, look up its (likely) script
|
||||
// If the lang code can be parsed as BCP47, look up its (likely) script.
|
||||
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1618034:
|
||||
// First strip any private subtags that would cause Locale to reject the
|
||||
// tag as non-wellformed.
|
||||
nsACString::const_iterator start, end;
|
||||
langStr.BeginReading(start);
|
||||
langStr.EndReading(end);
|
||||
if (FindInReadable(NS_LITERAL_CSTRING("-x-"), start, end)) {
|
||||
// The substring we want ends at the beginning of the "-x-" subtag.
|
||||
langStr.Truncate(start.get() - langStr.BeginReading());
|
||||
}
|
||||
|
||||
Locale loc(langStr);
|
||||
if (loc.IsWellFormed()) {
|
||||
// Fill in script subtag if not present.
|
||||
|
Loading…
Reference in New Issue
Block a user