summaryrefslogtreecommitdiffstats
path: root/chrome/browser/translate
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/translate')
-rw-r--r--chrome/browser/translate/translate_manager.cc15
1 files changed, 13 insertions, 2 deletions
diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc
index 00312b1..d1ee940 100644
--- a/chrome/browser/translate/translate_manager.cc
+++ b/chrome/browser/translate/translate_manager.cc
@@ -214,6 +214,9 @@ void TranslateManager::InitAcceptLanguages(PrefService* prefs) {
LanguageSet accept_langs_set;
SplitString(WideToASCII(accept_langs_str), ',', &accept_langs_list);
std::vector<std::string>::const_iterator iter;
+ std::string ui_lang = TranslationService::GetLanguageCode(
+ g_browser_process->GetApplicationLocale());
+ bool is_ui_english = StartsWithASCII(ui_lang, "en-", false);
for (iter = accept_langs_list.begin();
iter != accept_langs_list.end(); ++iter) {
// Get rid of the locale extension if any (ex: en-US -> en), but for Chinese
@@ -221,8 +224,16 @@ void TranslateManager::InitAcceptLanguages(PrefService* prefs) {
std::string accept_lang(*iter);
size_t index = iter->find("-");
if (index != std::string::npos && *iter != "zh-CN" && *iter != "zh-TW")
- accept_lang = iter->substr(0, iter->length() - index - 1);
- accept_langs_set.insert(accept_lang);
+ accept_lang = iter->substr(0, index);
+ // Special-case English until we resolve bug 36182 properly.
+ // Add English only if the UI language is not English. This will annoy
+ // users of non-English Chrome who can comprehend English until English is
+ // black-listed.
+ // TODO(jungshik): Once we determine that it's safe to remove English from
+ // the default Accept-Language values for most locales, remove this
+ // special-casing.
+ if (accept_lang != "en" || is_ui_english)
+ accept_langs_set.insert(accept_lang);
}
accept_languages_[prefs] = accept_langs_set;
}