Bug #45816 --> fix i18n breakage of intl-accept pref by calling getLocalizedUnicharPref

r=tao


git-svn-id: svn://10.0.0.236/trunk@74479 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
mscott%netscape.com
2000-07-19 21:41:59 +00:00
parent 82e9409289
commit 7ebcebcd5b

View File

@@ -4225,15 +4225,16 @@ void nsImapProtocol::Language()
// extract the desired language attribute from prefs
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIPref, prefs, kPrefCID, &rv);
nsXPIDLCString acceptLanguages;
nsXPIDLString acceptLanguages;
if (NS_SUCCEEDED(rv) && prefs)
prefs->CopyCharPref("intl.accept_languages", getter_Copies(acceptLanguages));
prefs->GetLocalizedUnicharPref("intl.accept_languages", getter_Copies(acceptLanguages));
// we need to parse out the first language out of this comma separated list....
// i.e if we have en,ja we only want to send en to the server.
if (acceptLanguages)
{
nsCAutoString extractedLanguage (acceptLanguages);
nsCAutoString extractedLanguage;
extractedLanguage.AssignWithConversion(acceptLanguages);
PRInt32 pos = extractedLanguage.FindChar(',', PR_TRUE);
if (pos > 0) // we have a comma separated list of languages...
extractedLanguage.Truncate(pos); // truncate everything after the first comma (including the comma)