зеркало из https://github.com/mozilla/pjs.git
if not all languages are in the right format, fall back to en-us rather than
picking the first one that is in the right format (bug 281107)
This commit is contained in:
Родитель
f5194e2808
Коммит
564dc31c38
|
@ -84,6 +84,10 @@ pref("accessibility.typeaheadfind.autostart", false);
|
|||
// image resizing
|
||||
pref("browser.enable_automatic_image_resizing", true);
|
||||
|
||||
// Languages (note we try to override this with the data from System Preferences,
|
||||
// this is just the emergency fall-back)
|
||||
pref("intl.accept_languages", "en-us, en" );
|
||||
|
||||
// enable horizontal scroll by shift+wheel
|
||||
pref("mousewheel.horizscroll.withshiftkey.action", 0);
|
||||
pref("mousewheel.horizscroll.withshiftkey.numlines", 1);
|
||||
|
|
|
@ -386,23 +386,27 @@ static BOOL gMadePrefManager;
|
|||
NSMutableArray* acceptableLanguages = [NSMutableArray array];
|
||||
|
||||
// Build the list of languages the user understands (from System Preferences | International).
|
||||
for (unsigned long i = 0; i < [languages count]; ++i) {
|
||||
BOOL languagesOkaySoFar = YES;
|
||||
for (unsigned long i = 0; languagesOkaySoFar && i < [languages count]; ++i) {
|
||||
NSString* language = [PreferenceManager convertLocaleToHTTPLanguage:[languages objectAtIndex:i]];
|
||||
if (language)
|
||||
[acceptableLanguages addObject:language];
|
||||
else {
|
||||
// If we don't understand a language don't set any, rather than risk leaving the user with
|
||||
// their n'th choice (which may be one Apple made and they don't actually read)
|
||||
// Mainly occurs on systems upgraded from 10.1, see convertLocaleToHTTPLanguage().
|
||||
NSLog( @"Unable to set languages - language '%@' not a valid ISO language identifier", [languages objectAtIndex:i] );
|
||||
languagesOkaySoFar = NO;
|
||||
}
|
||||
}
|
||||
|
||||
// Create the accept-language header itself from the language list. Note that
|
||||
// necko will determine quality factors itself.
|
||||
NSMutableString* acceptLangHeader = [NSMutableString string];
|
||||
for (unsigned long i = 0; i < [acceptableLanguages count]; ++i) {
|
||||
if (i > 0)
|
||||
[acceptLangHeader appendString:@","];
|
||||
[acceptLangHeader appendString:[acceptableLanguages objectAtIndex:i]];
|
||||
}
|
||||
|
||||
if ([acceptLangHeader length] > 0)
|
||||
// If we understood all the languages in the list set the accept-language header.
|
||||
// Note that necko will determine quality factors itself.
|
||||
// If we don't set this we'll fall back to the "en-us, en" default from all-camino.js
|
||||
if (languagesOkaySoFar && [acceptableLanguages count] > 0) {
|
||||
NSString* acceptLangHeader = [acceptableLanguages componentsJoinedByString:@","];
|
||||
[self setPref:"intl.accept_languages" toString:acceptLangHeader];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче