Changed to use x-western lang group for the error fallback,

patch by shanjian, bug 128338, r=smontage, sr=blizzard, a=scc.
This commit is contained in:
nhotta%netscape.com 2002-03-20 21:27:32 +00:00
parent 9318a2b270
commit b75b528258

View File

@ -198,19 +198,21 @@ nsLanguageAtomService::LookupLanguage(const PRUnichar* aLanguage,
} else if (lowered.Equals(NS_LITERAL_STRING("ja-jp"))) {
langGroupStr.Assign(NS_LITERAL_STRING("ja"));
} else {
if (!mLangGroups) {
NS_ENSURE_SUCCESS(InitLangGroupTable(), NS_ERROR_FAILURE);
}
res = mLangGroups->GetStringProperty(lowered, langGroupStr);
if (NS_FAILED(res)) {
PRInt32 hyphen = lowered.FindChar('-');
if (hyphen >= 0) {
nsAutoString truncated(lowered);
truncated.Truncate(hyphen);
res = mLangGroups->GetStringProperty(truncated, langGroupStr);
if (NS_FAILED(res)) {
langGroupStr.Assign(NS_LITERAL_STRING("x-western"));
if (!mLangGroups) {
NS_ENSURE_SUCCESS(InitLangGroupTable(), NS_ERROR_FAILURE);
}
res = mLangGroups->GetStringProperty(lowered, langGroupStr);
if (NS_FAILED(res)) {
PRInt32 hyphen = lowered.FindChar('-');
if (hyphen >= 0) {
nsAutoString truncated(lowered);
truncated.Truncate(hyphen);
res = mLangGroups->GetStringProperty(truncated, langGroupStr);
if (NS_FAILED(res)) {
langGroupStr.Assign(NS_LITERAL_STRING("x-western"));
}
} else {
langGroupStr.Assign(NS_LITERAL_STRING("x-western"));
}
}
}