diff options
author | jshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 21:16:46 +0000 |
---|---|---|
committer | jshin@chromium.org <jshin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-11 21:16:46 +0000 |
commit | 3117306367ccfee1595e668ffc1101979c4823e8 (patch) | |
tree | 58374e93e2281b3797c2cbb38955c6ccf3107964 /app/l10n_util_unittest.cc | |
parent | ec3625e3d6de06cbb2bf79531af92eaf61c14bf8 (diff) | |
download | chromium_src-3117306367ccfee1595e668ffc1101979c4823e8.zip chromium_src-3117306367ccfee1595e668ffc1101979c4823e8.tar.gz chromium_src-3117306367ccfee1595e668ffc1101979c4823e8.tar.bz2 |
Maps our internal Chinese locale codes to those expected by the ICU API for
the display name of a locale and expected by Google (in case of 'nb vs no').
1. Map zh-CN and zh-TW to zh-Hans and zh-Hant in GetDisplay
2. Map nb to no before adding 'hl' param for Google services. This will be removed once Google begins to honor 'nb'.
3. While doing so, I found that language_combox_model.cc has the exactly the
same code as in l10n_util.cc and refactored it.
BUG=34531
TEST=1. app_unittest: L10nUt*.LocaleDispla*
2. See the bug 34531
3. On Windows, the language menu in
Options | Under the hood | Fonts & Language Menu | Language tab lists
'Chinese (Simplified Han)' and 'Chinese (Traditional Han)' for Simplified
Chinese and Traditional Chinese in English Chrome along with
Chinese names for those two languages. This is the behavior
without this CL and it should't change with the refactoring.
Review URL: http://codereview.chromium.org/596033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@38813 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/l10n_util_unittest.cc')
-rw-r--r-- | app/l10n_util_unittest.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc index 693c586..bd55ff9 100644 --- a/app/l10n_util_unittest.cc +++ b/app/l10n_util_unittest.cc @@ -513,3 +513,19 @@ TEST_F(L10nUtilTest, UpperLower) { result = l10n_util::ToUpper(mixed); EXPECT_EQ(result, expected_upper); } + +TEST_F(L10nUtilTest, LocaleDisplayName) { + // TODO(jungshik): Make this test more extensive. + // Test zh-CN and zh-TW are treated as zh-Hans and zh-Hant. + string16 result = l10n_util::GetDisplayNameForLocale("zh-CN", "en", false); + EXPECT_EQ(result, ASCIIToUTF16("Chinese (Simplified Han)")); + + result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false); + EXPECT_EQ(result, ASCIIToUTF16("Chinese (Traditional Han)")); + + result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); + EXPECT_EQ(result, ASCIIToUTF16("Portuguese (Brazil)")); + + result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); + EXPECT_EQ(result, ASCIIToUTF16("Spanish (Latin America and the Caribbean)")); +} |