ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / components / translate / core / language_detection / language_detection_util.h
blobaa3f0bc0679fd59f7ed8d67bc8a2632c462402ca
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_TRANSLATE_CORE_LANGUAGE_DETECTION_LANGUAGE_DETECTION_UTIL_H_
6 #define COMPONENTS_TRANSLATE_CORE_LANGUAGE_DETECTION_LANGUAGE_DETECTION_UTIL_H_
8 #include <string>
10 #include "base/strings/string16.h"
12 namespace translate {
14 // Determines content page language from Content-Language code and contents.
15 std::string DeterminePageLanguage(const std::string& code,
16 const std::string& html_lang,
17 const base::string16& contents,
18 std::string* cld_language,
19 bool* is_cld_reliable);
21 // Corrects language code if it contains well-known mistakes.
22 // Called only by tests.
23 void CorrectLanguageCodeTypo(std::string* code);
25 // Checks if the language code's format is valid.
26 // Called only by tests.
27 bool IsValidLanguageCode(const std::string& code);
29 // Checks if languages are matched, or similar. This function returns true
30 // against a language pair containing a language which is difficult for CLD to
31 // distinguish.
32 // Called only by tests.
33 bool IsSameOrSimilarLanguages(const std::string& page_language,
34 const std::string& cld_language);
36 // Checks if languages pair is one of well-known pairs of wrong server
37 // configuration.
38 // Called only by tests.
39 bool MaybeServerWrongConfiguration(const std::string& page_language,
40 const std::string& cld_language);
42 } // namespace translate
44 #endif // COMPONENTS_TRANSLATE_CORE_LANGUAGE_DETECTION_LANGUAGE_DETECTION_UTIL_H_