summaryrefslogtreecommitdiffstats
path: root/components/translate/language_detection/language_detection_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'components/translate/language_detection/language_detection_util.cc')
-rw-r--r--components/translate/language_detection/language_detection_util.cc27
1 files changed, 15 insertions, 12 deletions
diff --git a/components/translate/language_detection/language_detection_util.cc b/components/translate/language_detection/language_detection_util.cc
index b452549..5532112 100644
--- a/components/translate/language_detection/language_detection_util.cc
+++ b/components/translate/language_detection/language_detection_util.cc
@@ -245,29 +245,32 @@ std::string DeterminePageLanguage(const std::string& code,
translate::ReportLanguageVerification(
translate::LANGUAGE_VERIFICATION_UNKNOWN);
return language;
- } else if (CanCLDComplementSubCode(language, cld_language)) {
+ }
+
+ if (CanCLDComplementSubCode(language, cld_language)) {
translate::ReportLanguageVerification(
translate::LANGUAGE_VERIFICATION_CLD_COMPLEMENT_SUB_CODE);
return cld_language;
- } else if (IsSameOrSimilarLanguages(language, cld_language)) {
+ }
+
+ if (IsSameOrSimilarLanguages(language, cld_language)) {
translate::ReportLanguageVerification(
translate::LANGUAGE_VERIFICATION_CLD_AGREE);
return language;
- } else if (MaybeServerWrongConfiguration(language, cld_language)) {
+ }
+
+ if (MaybeServerWrongConfiguration(language, cld_language)) {
translate::ReportLanguageVerification(
translate::LANGUAGE_VERIFICATION_TRUST_CLD);
return cld_language;
- } else {
- translate::ReportLanguageVerification(
- translate::LANGUAGE_VERIFICATION_CLD_DISAGREE);
- // Content-Language value might be wrong because CLD says that this page
- // is written in another language with confidence.
- // In this case, Chrome doesn't rely on any of the language codes, and
- // gives up suggesting a translation.
- return std::string(kUnknownLanguageCode);
}
- return language;
+ // Content-Language value might be wrong because CLD says that this page is
+ // written in another language with confidence. In this case, Chrome doesn't
+ // rely on any of the language codes, and gives up suggesting a translation.
+ translate::ReportLanguageVerification(
+ translate::LANGUAGE_VERIFICATION_CLD_DISAGREE);
+ return kUnknownLanguageCode;
}
void CorrectLanguageCodeTypo(std::string* code) {