Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: chrome/common/l10n_util.cc

Issue 45054: Block Oriya locale on Windows XP.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/l10n_util.h ('k') | chrome/common/l10n_util_posix.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/common/l10n_util.h" 7 #include "chrome/common/l10n_util.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 bool IsLocaleAvailable(const std::wstring& locale, 122 bool IsLocaleAvailable(const std::wstring& locale,
123 const std::wstring& locale_path) { 123 const std::wstring& locale_path) {
124 std::wstring test_locale = locale; 124 std::wstring test_locale = locale;
125 // If locale has any illegal characters in it, we don't want to try to 125 // If locale has any illegal characters in it, we don't want to try to
126 // load it because it may be pointing outside the locale data file directory. 126 // load it because it may be pointing outside the locale data file directory.
127 file_util::ReplaceIllegalCharacters(&test_locale, ' '); 127 file_util::ReplaceIllegalCharacters(&test_locale, ' ');
128 if (test_locale != locale) 128 if (test_locale != locale)
129 return false; 129 return false;
130 130
131 if (!l10n_util::IsLocaleSupportedByOS(locale))
132 return false;
133
131 FilePath test_path = FilePath::FromWStringHack(locale_path) 134 FilePath test_path = FilePath::FromWStringHack(locale_path)
132 .Append(FilePath::FromWStringHack(locale)) 135 .Append(FilePath::FromWStringHack(locale))
133 .ReplaceExtension(kLocaleFileExtension); 136 .ReplaceExtension(kLocaleFileExtension);
134 return file_util::PathExists(test_path) && SetICUDefaultLocale(locale); 137 return file_util::PathExists(test_path) && SetICUDefaultLocale(locale);
135 } 138 }
136 139
137 bool CheckAndResolveLocale(const std::wstring& locale, 140 bool CheckAndResolveLocale(const std::wstring& locale,
138 const std::wstring& locale_path, 141 const std::wstring& locale_path,
139 std::wstring* resolved_locale) { 142 std::wstring* resolved_locale) {
140 if (IsLocaleAvailable(locale, locale_path)) { 143 if (IsLocaleAvailable(locale, locale_path)) {
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 661
659 const std::vector<std::string>& GetAvailableLocales() { 662 const std::vector<std::string>& GetAvailableLocales() {
660 static std::vector<std::string> locales; 663 static std::vector<std::string> locales;
661 if (locales.empty()) { 664 if (locales.empty()) {
662 int num_locales = uloc_countAvailable(); 665 int num_locales = uloc_countAvailable();
663 for (int i = 0; i < num_locales; ++i) { 666 for (int i = 0; i < num_locales; ++i) {
664 std::string locale_name = uloc_getAvailable(i); 667 std::string locale_name = uloc_getAvailable(i);
665 // Filter out the names that have aliases. 668 // Filter out the names that have aliases.
666 if (IsDuplicateName(locale_name)) 669 if (IsDuplicateName(locale_name))
667 continue; 670 continue;
671 if (!IsLocaleSupportedByOS(ASCIIToWide(locale_name)))
672 continue;
668 // Normalize underscores to hyphens because that's what our locale files 673 // Normalize underscores to hyphens because that's what our locale files
669 // use. 674 // use.
670 std::replace(locale_name.begin(), locale_name.end(), '_', '-'); 675 std::replace(locale_name.begin(), locale_name.end(), '_', '-');
671 676
672 // Map the Chinese locale names over to zh-CN and zh-TW. 677 // Map the Chinese locale names over to zh-CN and zh-TW.
673 if (LowerCaseEqualsASCII(locale_name, "zh-hans")) { 678 if (LowerCaseEqualsASCII(locale_name, "zh-hans")) {
674 locale_name = "zh-CN"; 679 locale_name = "zh-CN";
675 } else if (LowerCaseEqualsASCII(locale_name, "zh-hant")) { 680 } else if (LowerCaseEqualsASCII(locale_name, "zh-hant")) {
676 locale_name = "zh-TW"; 681 locale_name = "zh-TW";
677 } 682 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 } 732 }
728 733
729 void BiDiLineIterator::GetLogicalRun(int start, 734 void BiDiLineIterator::GetLogicalRun(int start,
730 int* end, 735 int* end,
731 UBiDiLevel* level) { 736 UBiDiLevel* level) {
732 DCHECK(bidi_ != NULL); 737 DCHECK(bidi_ != NULL);
733 ubidi_getLogicalRun(bidi_, start, end, level); 738 ubidi_getLogicalRun(bidi_, start, end, level);
734 } 739 }
735 740
736 } 741 }
OLDNEW
« no previous file with comments | « chrome/common/l10n_util.h ('k') | chrome/common/l10n_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698