зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 1 changesets (bug 1423463) for failing due to syntax errors in /builds/worker/workspace/build/src/intl/locale/LocaleService.cpp r=backout on a CLOSED TREE
Backed out changeset 97f4bb99a1a9 (bug 1423463)
This commit is contained in:
Родитель
e882c9b394
Коммит
8c4a5326da
|
@ -81,12 +81,14 @@ ReadRequestedLocales(nsTArray<nsCString>& aRetVal)
|
|||
if (str.Length() > 0) {
|
||||
for (const nsACString& part : str.Split(',')) {
|
||||
nsAutoCString locale(part);
|
||||
if (locale.EqualsLiteral("ja-JP-mac")) {
|
||||
// This is a hack required to handle the special Mozilla `ja-JP-mac` locale.
|
||||
if (!aRetVal.Contains(locale)) {
|
||||
aRetVal.AppendElement(locale);
|
||||
if (SanitizeForBCP47(locale, true)) {
|
||||
// This is a hack required for us to handle the special Mozilla `ja-JP-mac`
|
||||
// locales. We sanitize the input to normalize the case etc. but in result
|
||||
// the `ja-JP-mac` will get turned into a BCP47 tag. Here we're turning it
|
||||
// back into the form expected by Gecko resources.
|
||||
if (locale.EqualsLiteral("ja-JP-x-lvariant-mac")) {
|
||||
locale.Assign("ja-JP-mac");
|
||||
}
|
||||
} else if (SanitizeForBCP47(locale, true)) {
|
||||
if (!aRetVal.Contains(locale)) {
|
||||
aRetVal.AppendElement(locale);
|
||||
}
|
||||
|
@ -835,7 +837,7 @@ LocaleService::Locale::Locale(const nsCString& aLocale, bool aRange)
|
|||
}
|
||||
break;
|
||||
case 3:
|
||||
if (part.EqualsLiteral("*") || part.Length() >= 3 && part.Length() <= 8) {
|
||||
if (part.EqualsLiteral("*") || part.Length() == 3) {
|
||||
mVariant.Assign(part);
|
||||
}
|
||||
break;
|
||||
|
@ -990,11 +992,14 @@ LocaleService::SetRequestedLocales(const char** aRequested,
|
|||
|
||||
for (uint32_t i = 0; i < aRequestedCount; i++) {
|
||||
nsAutoCString locale(aRequested[i]);
|
||||
if (!locale.EqualsLiteral("ja-JP-mac") &&
|
||||
!SanitizeForBCP47(locale, true)) {
|
||||
if (!SanitizeForBCP47(locale, true)) {
|
||||
NS_ERROR("Invalid language tag provided to SetRequestedLocales!");
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
if (locale.EqualsLiteral("ja-JP-x-lvariant-mac")) {
|
||||
// This is a hack for our code to handle `ja-JP-mac` special case.
|
||||
locale.Assign("ja-JP-mac");
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
str.AppendLiteral(",");
|
||||
|
|
Загрузка…
Ссылка в новой задаче