diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 47be89d54e51..0cea77e05bf4 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -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 diff --git a/layout/generic/nsTextRunTransformations.cpp b/layout/generic/nsTextRunTransformations.cpp index 03ddac7bef07..95feb300d962 100644 --- a/layout/generic/nsTextRunTransformations.cpp +++ b/layout/generic/nsTextRunTransformations.cpp @@ -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(aLang)); + int index = langStr.FindChar('-'); + if (index > 0) { + langStr.Truncate(index); + nsCOMPtr truncatedLang = do_GetAtom(langStr); + return GetCasingFor(truncatedLang); + } + return eLSCB_None; }