зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1616999 - Rename MozLocale::AddLikelySubtags to Maximize following ECMA402 Intl.Locale convention. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D63561 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
4bef3a1792
Коммит
dcb4bfbaa7
|
@ -1272,6 +1272,7 @@ dependencies = [
|
|||
"nsstring",
|
||||
"thin-vec",
|
||||
"unic-langid",
|
||||
"unic-langid-ffi",
|
||||
"xpcom",
|
||||
]
|
||||
|
||||
|
|
|
@ -467,7 +467,7 @@ void nsLineBreaker::UpdateCurrentWordLanguage(nsAtom* aHyphenationLanguage) {
|
|||
if (aHyphenationLanguage && !mCurrentWordLanguage) {
|
||||
Locale loc = Locale(nsAtomCString(aHyphenationLanguage));
|
||||
if (loc.GetScript().IsEmpty()) {
|
||||
loc.AddLikelySubtags();
|
||||
loc.Maximize();
|
||||
}
|
||||
const nsDependentCSubstring& script = loc.GetScript();
|
||||
mScriptIsChineseOrJapanese =
|
||||
|
|
|
@ -52,9 +52,7 @@ bool Locale::Matches(const Locale& aOther, bool aThisRange,
|
|||
return unic_langid_matches(mRaw.get(), aOther.Raw(), aThisRange, aOtherRange);
|
||||
}
|
||||
|
||||
bool Locale::AddLikelySubtags() {
|
||||
return unic_langid_add_likely_subtags(mRaw.get());
|
||||
}
|
||||
bool Locale::Maximize() { return unic_langid_maximize(mRaw.get()); }
|
||||
|
||||
void Locale::ClearVariants() { unic_langid_clear_variants(mRaw.get()); }
|
||||
|
||||
|
|
|
@ -110,9 +110,9 @@ class Locale {
|
|||
*
|
||||
* Example:
|
||||
*
|
||||
* Locale("en").AddLikelySubtags().AsString(); // "en-Latn-US"
|
||||
* Locale("en").Maximize().AsString(); // "en-Latn-US"
|
||||
*/
|
||||
bool AddLikelySubtags();
|
||||
bool Maximize();
|
||||
|
||||
/**
|
||||
* Clears the variants field of the Locale object.
|
||||
|
|
|
@ -175,7 +175,7 @@ nsStaticAtom* nsLanguageAtomService::GetUncachedLanguageGroup(
|
|||
if (loc.IsWellFormed()) {
|
||||
// Fill in script subtag if not present.
|
||||
if (loc.GetScript().IsEmpty()) {
|
||||
loc.AddLikelySubtags();
|
||||
loc.Maximize();
|
||||
}
|
||||
// Traditional Chinese has separate prefs for Hong Kong / Taiwan;
|
||||
// check the region subtag.
|
||||
|
|
|
@ -159,6 +159,6 @@ pub unsafe extern "C" fn unic_langid_matches(
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn unic_langid_add_likely_subtags(langid: &mut LanguageIdentifier) -> bool {
|
||||
pub unsafe extern "C" fn unic_langid_maximize(langid: &mut LanguageIdentifier) -> bool {
|
||||
langid.maximize()
|
||||
}
|
||||
|
|
|
@ -66,11 +66,10 @@ bool OSPreferences::ReadSystemLocales(nsTArray<nsCString>& aLocaleList) {
|
|||
// language code with no region subtag, but the
|
||||
// GlobalizationPreferences API may give us one (e.g. "ja").
|
||||
// So if there's no hyphen in the string at this point, we use
|
||||
// Locale::AddLikelySubtags to get a suitable region code to
|
||||
// Locale::Maximize to get a suitable region code to
|
||||
// go with it.
|
||||
Locale locale(loc);
|
||||
if (locale.AddLikelySubtags() &&
|
||||
!locale.GetRegion().IsEmpty()) {
|
||||
if (locale.Maximize() && !locale.GetRegion().IsEmpty()) {
|
||||
loc.Append('-');
|
||||
loc.Append(locale.GetRegion());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче