bug 1048050 - ignore region (or other) subtags when checking for language-specific casing behavior. r=smontagu

This commit is contained in:
Jonathan Kew 2014-08-11 09:49:11 +01:00
parent f98de73684
commit 31f53d899f
2 changed files with 15 additions and 2 deletions

View File

@ -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

View File

@ -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;
}