| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 "en-US", | 113 "en-US", |
| 114 "en-GB", | 114 "en-GB", |
| 115 "fr", | 115 "fr", |
| 116 "es-419", | 116 "es-419", |
| 117 "es", | 117 "es", |
| 118 "zh-TW", | 118 "zh-TW", |
| 119 "zh-CN", | 119 "zh-CN", |
| 120 "he", | 120 "he", |
| 121 "fil", | 121 "fil", |
| 122 "nb", | 122 "nb", |
| 123 "or", | 123 "am", |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 #if defined(OS_WIN) | 126 #if defined(OS_WIN) |
| 127 static const char kLocaleFileExtension[] = ".dll"; | 127 static const char kLocaleFileExtension[] = ".dll"; |
| 128 #elif defined(OS_POSIX) | 128 #elif defined(OS_POSIX) |
| 129 static const char kLocaleFileExtension[] = ".pak"; | 129 static const char kLocaleFileExtension[] = ".pak"; |
| 130 #endif | 130 #endif |
| 131 for (size_t i = 0; i < arraysize(filenames); ++i) { | 131 for (size_t i = 0; i < arraysize(filenames); ++i) { |
| 132 FilePath filename = new_locale_dir.AppendASCII( | 132 FilePath filename = new_locale_dir.AppendASCII( |
| 133 filenames[i] + kLocaleFileExtension); | 133 filenames[i] + kLocaleFileExtension); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 | 227 |
| 228 SetICUDefaultLocale("es-AR"); | 228 SetICUDefaultLocale("es-AR"); |
| 229 EXPECT_EQ("es", l10n_util::GetApplicationLocale(L"es")); | 229 EXPECT_EQ("es", l10n_util::GetApplicationLocale(L"es")); |
| 230 | 230 |
| 231 SetICUDefaultLocale("zh-HK"); | 231 SetICUDefaultLocale("zh-HK"); |
| 232 EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale(L"zh-CN")); | 232 EXPECT_EQ("zh-CN", l10n_util::GetApplicationLocale(L"zh-CN")); |
| 233 | 233 |
| 234 SetICUDefaultLocale("he"); | 234 SetICUDefaultLocale("he"); |
| 235 EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L"en")); | 235 EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L"en")); |
| 236 | 236 |
| 237 // Oriya should be blocked unless OS is Vista or newer. | 237 // Amharic should be blocked unless OS is Vista or newer. |
| 238 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { | 238 if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) { |
| 239 SetICUDefaultLocale("or"); | 239 SetICUDefaultLocale("am"); |
| 240 EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L"")); | 240 EXPECT_EQ("en-US", l10n_util::GetApplicationLocale(L"")); |
| 241 SetICUDefaultLocale("en-GB"); | 241 SetICUDefaultLocale("en-GB"); |
| 242 EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(L"or")); | 242 EXPECT_EQ("en-GB", l10n_util::GetApplicationLocale(L"am")); |
| 243 } else { | 243 } else { |
| 244 SetICUDefaultLocale("or"); | 244 SetICUDefaultLocale("am"); |
| 245 EXPECT_EQ("or", l10n_util::GetApplicationLocale(L"")); | 245 EXPECT_EQ("am", l10n_util::GetApplicationLocale(L"")); |
| 246 SetICUDefaultLocale("en-GB"); | 246 SetICUDefaultLocale("en-GB"); |
| 247 EXPECT_EQ("or", l10n_util::GetApplicationLocale(L"or")); | 247 EXPECT_EQ("am", l10n_util::GetApplicationLocale(L"am")); |
| 248 } | 248 } |
| 249 #endif // defined(OS_WIN) | 249 #endif // defined(OS_WIN) |
| 250 | 250 |
| 251 // Clean up. | 251 // Clean up. |
| 252 PathService::Override(app::DIR_LOCALES, orig_locale_dir); | 252 PathService::Override(app::DIR_LOCALES, orig_locale_dir); |
| 253 file_util::Delete(new_locale_dir, true); | 253 file_util::Delete(new_locale_dir, true); |
| 254 UErrorCode error_code = U_ZERO_ERROR; | 254 UErrorCode error_code = U_ZERO_ERROR; |
| 255 icu::Locale::setDefault(locale, error_code); | 255 icu::Locale::setDefault(locale, error_code); |
| 256 } | 256 } |
| 257 #endif // !defined(OS_MACOSX) | 257 #endif // !defined(OS_MACOSX) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 291 |
| 292 result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false); | 292 result = l10n_util::GetDisplayNameForLocale("zh-TW", "en", false); |
| 293 EXPECT_EQ(result, ASCIIToUTF16("Chinese (Traditional Han)")); | 293 EXPECT_EQ(result, ASCIIToUTF16("Chinese (Traditional Han)")); |
| 294 | 294 |
| 295 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); | 295 result = l10n_util::GetDisplayNameForLocale("pt-BR", "en", false); |
| 296 EXPECT_EQ(result, ASCIIToUTF16("Portuguese (Brazil)")); | 296 EXPECT_EQ(result, ASCIIToUTF16("Portuguese (Brazil)")); |
| 297 | 297 |
| 298 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); | 298 result = l10n_util::GetDisplayNameForLocale("es-419", "en", false); |
| 299 EXPECT_EQ(result, ASCIIToUTF16("Spanish (Latin America and the Caribbean)")); | 299 EXPECT_EQ(result, ASCIIToUTF16("Spanish (Latin America and the Caribbean)")); |
| 300 } | 300 } |
| OLD | NEW |