mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
bug 1048050 - ignore region (or other) subtags when checking for language-specific casing behavior. r=smontagu
This commit is contained in:
parent
f98de73684
commit
31f53d899f
@ -2054,7 +2054,7 @@ GK_ATOM(az, "az")
|
||||
GK_ATOM(ba, "ba")
|
||||
GK_ATOM(crh, "crh")
|
||||
GK_ATOM(el, "el")
|
||||
GK_ATOM(ga_ie, "ga-ie")
|
||||
GK_ATOM(ga, "ga")
|
||||
GK_ATOM(nl, "nl")
|
||||
|
||||
// Names for editor transactions
|
||||
|
@ -235,6 +235,9 @@ enum LanguageSpecificCasingBehavior {
|
||||
static LanguageSpecificCasingBehavior
|
||||
GetCasingFor(const nsIAtom* aLang)
|
||||
{
|
||||
if (!aLang) {
|
||||
return eLSCB_None;
|
||||
}
|
||||
if (aLang == nsGkAtoms::tr ||
|
||||
aLang == nsGkAtoms::az ||
|
||||
aLang == nsGkAtoms::ba ||
|
||||
@ -248,9 +251,19 @@ GetCasingFor(const nsIAtom* aLang)
|
||||
if (aLang == nsGkAtoms::el) {
|
||||
return eLSCB_Greek;
|
||||
}
|
||||
if (aLang == nsGkAtoms::ga_ie) {
|
||||
if (aLang == nsGkAtoms::ga) {
|
||||
return eLSCB_Irish;
|
||||
}
|
||||
|
||||
// Is there a region subtag we should ignore?
|
||||
nsAtomString langStr(const_cast<nsIAtom*>(aLang));
|
||||
int index = langStr.FindChar('-');
|
||||
if (index > 0) {
|
||||
langStr.Truncate(index);
|
||||
nsCOMPtr<nsIAtom> truncatedLang = do_GetAtom(langStr);
|
||||
return GetCasingFor(truncatedLang);
|
||||
}
|
||||
|
||||
return eLSCB_None;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user