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

Unified Diff: components/translate/core/language_detection/language_detection_util.cc

Issue 2359793003: Modifying language detection code (Closed)
Patch Set: Extending the comment about xx-Latn languages Created 4 years, 3 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 | extensions/renderer/i18n_custom_bindings.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/translate/core/language_detection/language_detection_util.cc
diff --git a/components/translate/core/language_detection/language_detection_util.cc b/components/translate/core/language_detection/language_detection_util.cc
index d4d1bfd36cbbba917b3099170379770687b87287..7028461680958d548ae48a4243cbbc6f7cebf353 100644
--- a/components/translate/core/language_detection/language_detection_util.cc
+++ b/components/translate/core/language_detection/language_detection_util.cc
@@ -197,7 +197,14 @@ std::string DetermineTextLanguage(const base::string16& text,
*is_cld_reliable = prediction_reliable;
}
+ // Ignore unreliable, "unknown", and xx-Latn predictions that are currently
+ // not supported.
if (prediction_reliable &&
+ predicted_language != "bg-Latn" &&
+ predicted_language != "el-Latn" &&
+ predicted_language != "ja-Latn" &&
+ predicted_language != "ru-Latn" &&
+ predicted_language != "zh-Latn" &&
predicted_language !=
chrome_lang_id::NNetLanguageIdentifier::kUnknown) {
// CLD3 returns 'zh' for Chinese but Translate doesn't accept it. Thus,
« no previous file with comments | « no previous file | extensions/renderer/i18n_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698