From 3117306367ccfee1595e668ffc1101979c4823e8 Mon Sep 17 00:00:00 2001 From: "jshin@chromium.org" Date: Thu, 11 Feb 2010 21:16:46 +0000 Subject: 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 --- app/l10n_util_unittest.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'app/l10n_util_unittest.cc') 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)")); +} -- cgit v1.1