OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/l10n/l10n_util.h" | 5 #include "ui/base/l10n/l10n_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 #include <iterator> | 9 #include <iterator> |
10 #include <string> | 10 #include <string> |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 else if (locale_code == "mo") | 533 else if (locale_code == "mo") |
534 locale_code = "ro-MD"; | 534 locale_code = "ro-MD"; |
535 | 535 |
536 base::string16 display_name; | 536 base::string16 display_name; |
537 #if defined(OS_ANDROID) | 537 #if defined(OS_ANDROID) |
538 // Use Java API to get locale display name so that we can remove most of | 538 // Use Java API to get locale display name so that we can remove most of |
539 // the lang data from icu data to reduce binary size, except for zh-Hans and | 539 // the lang data from icu data to reduce binary size, except for zh-Hans and |
540 // zh-Hant because the current Android Java API doesn't support scripts. | 540 // zh-Hant because the current Android Java API doesn't support scripts. |
541 // TODO(wangxianzhu): remove the special handling of zh-Hans and zh-Hant once | 541 // TODO(wangxianzhu): remove the special handling of zh-Hans and zh-Hant once |
542 // Android Java API supports scripts. | 542 // Android Java API supports scripts. |
543 if (!base::StartsWithASCII(locale_code, "zh-Han", true)) { | 543 if (!base::StartsWith(locale_code, "zh-Han", base::CompareCase::SENSITIVE)) { |
544 display_name = GetDisplayNameForLocale(locale_code, display_locale); | 544 display_name = GetDisplayNameForLocale(locale_code, display_locale); |
545 } else | 545 } else |
546 #endif | 546 #endif |
547 { | 547 { |
548 UErrorCode error = U_ZERO_ERROR; | 548 UErrorCode error = U_ZERO_ERROR; |
549 const int kBufferSize = 1024; | 549 const int kBufferSize = 1024; |
550 | 550 |
551 int actual_size = uloc_getDisplayName( | 551 int actual_size = uloc_getDisplayName( |
552 locale_code.c_str(), display_locale.c_str(), | 552 locale_code.c_str(), display_locale.c_str(), |
553 base::WriteInto(&display_name, kBufferSize), kBufferSize - 1, &error); | 553 base::WriteInto(&display_name, kBufferSize), kBufferSize - 1, &error); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
874 | 874 |
875 const char* const* GetAcceptLanguageListForTesting() { | 875 const char* const* GetAcceptLanguageListForTesting() { |
876 return kAcceptLanguageList; | 876 return kAcceptLanguageList; |
877 } | 877 } |
878 | 878 |
879 size_t GetAcceptLanguageListSizeForTesting() { | 879 size_t GetAcceptLanguageListSizeForTesting() { |
880 return arraysize(kAcceptLanguageList); | 880 return arraysize(kAcceptLanguageList); |
881 } | 881 } |
882 | 882 |
883 } // namespace l10n_util | 883 } // namespace l10n_util |
OLD | NEW |