Index: chrome/browser/translate/translate_prefs.cc |
diff --git a/chrome/browser/translate/translate_prefs.cc b/chrome/browser/translate/translate_prefs.cc |
index df9e1b64104281c288a8b5a284a75573638da83b..2b5589abc776b91638aec654575dca5e6b3579f8 100644 |
--- a/chrome/browser/translate/translate_prefs.cc |
+++ b/chrome/browser/translate/translate_prefs.cc |
@@ -47,26 +47,6 @@ void GetBlacklistedLanguages(const PrefService* prefs, |
} |
} |
-// Converts the language code for Translate. This removes the sub code (like |
-// -US) except for Chinese, and converts the synonyms. |
-// The same logic exists at language_options.js, and please keep consistensy |
-// with the JavaScript file. |
-std::string ConvertLangCodeForTranslation(const std::string &lang) { |
- std::vector<std::string> tokens; |
- base::SplitString(lang, '-', &tokens); |
- if (tokens.size() < 1) |
- return lang; |
- |
- std::string main_part = tokens[0]; |
- |
- // Translate doesn't support General Chinese and the sub code is necessary. |
- if (main_part == "zh") |
- return lang; |
- |
- translate::ToTranslateLanguageSynonym(&main_part); |
- return main_part; |
-} |
- |
// Expands language codes to make these more suitable for Accept-Language. |
// Example: ['en-US', 'ja', 'en-CA'] => ['en-US', 'en', 'ja', 'en-CA']. |
// 'en' won't appear twice as this function eliminates duplicates. |
@@ -471,6 +451,24 @@ void TranslatePrefs::CreateBlockedLanguages( |
result.begin(), result.end()); |
} |
+// static |
+std::string TranslatePrefs::ConvertLangCodeForTranslation( |
+ const std::string &lang) { |
+ std::vector<std::string> tokens; |
+ base::SplitString(lang, '-', &tokens); |
+ if (tokens.size() < 1) |
+ return lang; |
+ |
+ std::string main_part = tokens[0]; |
+ |
+ // Translate doesn't support General Chinese and the sub code is necessary. |
+ if (main_part == "zh") |
+ return lang; |
+ |
+ translate::ToTranslateLanguageSynonym(&main_part); |
+ return main_part; |
+} |
+ |
bool TranslatePrefs::IsValueInList(const ListValue* list, |
const std::string& in_value) const { |
for (size_t i = 0; i < list->GetSize(); ++i) { |