Bug fix: Translate: CLD2 imcompatibility

CLD2 returns zh-Hant insteaad of zh-TW, but this is an incompatible behavior.  I fixed it by simply converting it in Chromium.

Some other language codes than zh-TW/Hant are also changed, but they doesn't affect the Translate feature.

BUG=301360

Review URL: https://codereview.chromium.org/25212002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@226449 0039d316-1c4b-4281-b951-d872f2087c98
parent 1eb9f02c
......@@ -152,8 +152,19 @@ std::string DetermineTextLanguage(const base::string16& text,
#endif
#if !defined(CLD_VERSION) || CLD_VERSION==2
case 2:
// (1) CLD2's LanguageCode returns general Chinese 'zh' for
// CLD2::CHINESE, but Translate server doesn't accept it. This is
// converted to 'zh-CN' in the same way as CLD1's
// LanguageCodeWithDialects.
//
// (2) CLD2's LanguageCode returns zh-Hant instead of zh-TW for
// CLD2::CHINESE_T. This is technically more precise for the language
// code of traditional Chinese, while Translate server hasn't accepted
// zh-Hant yet.
if (cld_language == CLD2::CHINESE) {
language = "zh-CN";
} else if (cld_language == CLD2::CHINESE_T) {
language = "zh-TW";
} else {
language =
CLD2::LanguageCode(static_cast<CLD2::Language>(cld_language));
......
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