summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authorjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-30 16:48:02 +0000
committerjcivelli@chromium.org <jcivelli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-30 16:48:02 +0000
commit7f90c383008605329c4f6dedcba0a7587aa6dfd9 (patch)
tree5a0753787094c7845075345c3e4da2417da12d2f /chrome/renderer
parent44db7c6b5a0dd41bfbd8145a74cc6948fe2d6c04 (diff)
downloadchromium_src-7f90c383008605329c4f6dedcba0a7587aa6dfd9.zip
chromium_src-7f90c383008605329c4f6dedcba0a7587aa6dfd9.tar.gz
chromium_src-7f90c383008605329c4f6dedcba0a7587aa6dfd9.tar.bz2
Adds support for language detection on the server side.
The CLD can sometimes fail to detect the language of a page, in which case the translate server might be able to. This CL ensures the browser deals with the server side language detection properly. Also added a new factory method to create error translate infobar delegates that does not assert when the language code is incorrect. Also changed the enums in TranslateInfoBarDelegate2 to use the constant name style, as it is the preferred naming for enums according to the style guide. Original review: http://codereview.chromium.org/2859013/show BUG=40857 TEST=Visit http://www.saanconf.org/saanday.htm, use the context menu to translate the page. You should get an error mentioning the page is already in English. Review URL: http://codereview.chromium.org/2860037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51263 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/translate_helper.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/chrome/renderer/translate_helper.cc b/chrome/renderer/translate_helper.cc
index 7caeec4..5075917 100644
--- a/chrome/renderer/translate_helper.cc
+++ b/chrome/renderer/translate_helper.cc
@@ -182,7 +182,10 @@ void TranslateHelper::CheckTranslateStatus() {
if (source_lang_ == kAutoDetectionLanguage) {
actual_source_lang = GetOriginalPageLanguage();
if (actual_source_lang.empty()) {
- NotifyBrowserTranslationFailed(TranslateErrors::TRANSLATION_ERROR);
+ NotifyBrowserTranslationFailed(TranslateErrors::UNKNOWN_LANGUAGE);
+ return;
+ } else if (actual_source_lang == target_lang_) {
+ NotifyBrowserTranslationFailed(TranslateErrors::IDENTICAL_LANGUAGES);
return;
}
} else {