Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Unified Diff: components/translate/core/browser/translate_manager.cc

Issue 2650003004: Don't offer to translate between Simplified and Traditional Chinese (Closed)
Patch Set: Fixes unittests by simulating online mode and setting behavior for mock function. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/translate/core/browser/translate_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/translate/core/browser/translate_manager.cc
diff --git a/components/translate/core/browser/translate_manager.cc b/components/translate/core/browser/translate_manager.cc
index 33d3c514a5d011646e21b4c5aedfbff7679a21f6..1c9183a27fb6df6deb62b1b12702caf4fe32e061 100644
--- a/components/translate/core/browser/translate_manager.cc
+++ b/components/translate/core/browser/translate_manager.cc
@@ -4,6 +4,7 @@
#include "components/translate/core/browser/translate_manager.h"
+#include <iostream>
kjellander_chromium 2017/01/26 05:30:06 I'm confused how this could pass the _CheckNoIOStr
#include <map>
#include "base/bind.h"
@@ -224,12 +225,14 @@ void TranslateManager::InitiateTranslation(const std::string& page_lang) {
InitTranslateEvent(language_code, target_lang, *translate_prefs);
// Don't translate similar languages (ex: en-US to en).
- if (language_code == target_lang) {
+ // Also do not offer to translate between Simplified and Traditional Chinese.
+ if (language_code == target_lang ||
+ (language_code == "zh-CN" && target_lang == "zh-TW") ||
+ (language_code == "zh-TW" && target_lang == "zh-CN")) {
TranslateBrowserMetrics::ReportInitiationStatus(
TranslateBrowserMetrics::INITIATION_STATUS_SIMILAR_LANGUAGES);
return;
}
-
// Nothing to do if either the language Chrome is in or the language of the
// page is not supported by the translation server.
if (target_lang.empty() ||
« no previous file with comments | « no previous file | components/translate/core/browser/translate_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698