Commit b747c13b authored by Megan Jablonski's avatar Megan Jablonski Committed by Commit Bot

[Translate] Don't use Unknown source for same language translation on Android and iOS

Bug: 1026217, 1026760
Change-Id: I9bed765c6cb16ba52d0f28eef28434cae3540dd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1927169Reviewed-by: default avataranthonyvd <anthonyvd@chromium.org>
Commit-Queue: Megan Jablonski <megjablon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720646}
parent d37a4944
......@@ -277,13 +277,17 @@ void TranslateManager::TranslatePage(const std::string& original_source_lang,
if (source_lang == target_lang) {
// If the languages are the same, try the translation using the unknown
// language code. The source and target languages should only be equal if
// the translation was manually triggered by the user. Rather than show them
// the error, we should attempt to send the page for translation. For pages
// with multiple languages we often detect same language, but the
// language code on Desktop. Android and iOS don't support unknown source
// language, so this silently falls back to 'auto' when making the
// translation request. The source and target languages should only be equal
// if the translation was manually triggered by the user. Rather than show
// them the error, we should attempt to send the page for translation. For
// page with multiple languages we often detect same language, but the
// Translation service is able to translate the various languages using it's
// own language detection.
#if !defined(OS_ANDROID) && !defined(OS_IOS)
source_lang = translate::kUnknownLanguageCode;
#endif
TranslateBrowserMetrics::ReportInitiationStatus(
TranslateBrowserMetrics::
INITIATION_STATUS_IDENTICAL_LANGUAGE_USE_SOURCE_LANGUAGE_UNKNOWN);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment