summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 22:58:23 +0000
committerjshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-23 22:58:23 +0000
commit9e48e083ee1d1c238bc836fb999b87a47c02277e (patch)
tree96d479c5f2ad80c042a64dac20bb3d9a1c07a233 /chrome/browser
parenteaebefafe519fadf44438f48925abecf8e04f0a1 (diff)
downloadchromium_src-9e48e083ee1d1c238bc836fb999b87a47c02277e.zip
chromium_src-9e48e083ee1d1c238bc836fb999b87a47c02277e.tar.gz
chromium_src-9e48e083ee1d1c238bc836fb999b87a47c02277e.tar.bz2
When building the accept-language list for translation, exclude English
unless the UI language is English. This is a temporary measure until we're sure that removing English from the default value of A-L for most non-English locale is safe in terms of web compatibility. BUG=36182 TEST=1. Run Chrome in English and go to any English page. Translation info-bar does not show up. 2. Run a non-English version of Chrome and go to any English page. Translation info-bar does show up. Review URL: http://codereview.chromium.org/652138 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39794 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-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;
}