Bug 1067026 - Fall back to en-US if search plugins aren't found for the user's locale. r=rnewman

This commit is contained in:
Margaret Leibovic 2014-09-16 16:35:39 -07:00
parent 60c559be95
commit c8dc3c02d7

View File

@ -233,19 +233,23 @@ public class SearchEngineManager implements SharedPreferences.OnSharedPreference
final String languageTag = BrowserLocaleManager.getLanguageTag(locale); final String languageTag = BrowserLocaleManager.getLanguageTag(locale);
String url = getSearchPluginsJarURL(languageTag, fileName); String url = getSearchPluginsJarURL(languageTag, fileName);
final InputStream in = GeckoJarReader.getStream(url); InputStream in = GeckoJarReader.getStream(url);
if (in != null) { if (in != null) {
return in; return in;
} }
// If that doesn't work, try a file path for just the language. // If that doesn't work, try a file path for just the language.
final String language = BrowserLocaleManager.getLanguage(locale); final String language = BrowserLocaleManager.getLanguage(locale);
if (languageTag.equals(language)) { if (!languageTag.equals(language)) {
// We already tried this, so just return null. url = getSearchPluginsJarURL(language, fileName);
return null; in = GeckoJarReader.getStream(url);
if (in != null) {
return in;
}
} }
url = getSearchPluginsJarURL(language, fileName); // Finally, fall back to en-US.
url = getSearchPluginsJarURL("en-US", fileName);
return GeckoJarReader.getStream(url); return GeckoJarReader.getStream(url);
} }