diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-18 11:40:01 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-18 11:40:01 +0000 |
commit | ca0ebd7a43a22a6c3a13e22fb849fbc49a76a084 (patch) | |
tree | a14a23d3b024120469c4d79c1431c9bf73738516 /chrome | |
parent | 559082445e4a04112224956a359fd7d806d28288 (diff) | |
download | chromium_src-ca0ebd7a43a22a6c3a13e22fb849fbc49a76a084.zip chromium_src-ca0ebd7a43a22a6c3a13e22fb849fbc49a76a084.tar.gz chromium_src-ca0ebd7a43a22a6c3a13e22fb849fbc49a76a084.tar.bz2 |
Handle pinyin's zh as zh-CN.
This is to make it compatible with the UI language code used in Chrome.
zh-CN is used for UI language code of Simplified Chinese.
BUG=chromium-os:2843
TEST=added a unit test and ran out/Release/unit_tests --gtest_filter='LanguageLibrary*'
Review URL: http://codereview.chromium.org/2102008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47504 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/cros/language_library.cc | 9 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/language_library_test.cc | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/chrome/browser/chromeos/cros/language_library.cc b/chrome/browser/chromeos/cros/language_library.cc index d294efe..3e76d36 100644 --- a/chrome/browser/chromeos/cros/language_library.cc +++ b/chrome/browser/chromeos/cros/language_library.cc @@ -110,11 +110,12 @@ bool LanguageLibrary::IsKeyboardLayout(const std::string& input_method_id) { std::string LanguageLibrary::GetLanguageCodeFromDescriptor( const InputMethodDescriptor& descriptor) { - // Special-case Chewing. Handle this as zh-TW, rather than zh. - // TODO: we should fix this issue in chewing engine rather than here. - if (descriptor.id == "chewing" && - descriptor.language_code == "zh") { + // Special-case Chewing/Pinyin. Handle these as zh-TW/zh-CN, rather than zh. + // TODO: we should fix this issue in engines rather than here. + if (descriptor.id == "chewing" && descriptor.language_code == "zh") { return "zh-TW"; + } else if (descriptor.id == "pinyin" && descriptor.language_code == "zh") { + return "zh-CN"; } std::string language_code = diff --git a/chrome/browser/chromeos/cros/language_library_test.cc b/chrome/browser/chromeos/cros/language_library_test.cc index cd77898..0205629 100644 --- a/chrome/browser/chromeos/cros/language_library_test.cc +++ b/chrome/browser/chromeos/cros/language_library_test.cc @@ -38,6 +38,8 @@ TEST(LanguageLibraryTest, GetLanguageCodeFromDescriptor) { InputMethodDescriptor("anthy", "Anthy", "us", "ja"))); EXPECT_EQ("zh-TW", LanguageLibrary::GetLanguageCodeFromDescriptor( InputMethodDescriptor("chewing", "Chewing", "us", "zh"))); + EXPECT_EQ("zh-CN", LanguageLibrary::GetLanguageCodeFromDescriptor( + InputMethodDescriptor("pinyin", "Pinyin", "us", "zh"))); EXPECT_EQ("en-US", LanguageLibrary::GetLanguageCodeFromDescriptor( InputMethodDescriptor("xkb:us::eng", "USA", "us", "eng"))); EXPECT_EQ("en-UK", LanguageLibrary::GetLanguageCodeFromDescriptor( |