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

Unified Diff: base/i18n/rtl.cc

Issue 269943004: Remove base version of GetCanonicalLocale() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: U_DISABLE_RENAMING Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: base/i18n/rtl.cc
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc
index d878c40da025b8845f2dc3d227efd27b5f64f789..f90efa32d951ba382ac05aa378a3785e209d5df8 100644
--- a/base/i18n/rtl.cc
+++ b/base/i18n/rtl.cc
@@ -16,30 +16,6 @@
namespace {
-// Extract language, country and variant, but ignore keywords. For example,
-// en-US, ca@valencia, ca-ES@valencia.
-std::string GetLocaleString(const icu::Locale& locale) {
- const char* language = locale.getLanguage();
- const char* country = locale.getCountry();
- const char* variant = locale.getVariant();
-
- std::string result =
- (language != NULL && *language != '\0') ? language : "und";
-
- if (country != NULL && *country != '\0') {
- result += '-';
- result += country;
- }
-
- if (variant != NULL && *variant != '\0') {
- std::string variant_str(variant);
- StringToLowerASCII(&variant_str);
- result += '@' + variant_str;
- }
-
- return result;
-}
-
// Returns LEFT_TO_RIGHT or RIGHT_TO_LEFT if |character| has strong
// directionality, returns UNKNOWN_DIRECTION if it doesn't. Please refer to
// http://unicode.org/reports/tr9/ for more information.
@@ -68,16 +44,33 @@ namespace i18n {
// Represents the locale-specific ICU text direction.
static TextDirection g_icu_text_direction = UNKNOWN_DIRECTION;
+std::string GetLocaleString(const icu::Locale& locale) {
+ const char* language = locale.getLanguage();
+ const char* country = locale.getCountry();
+ const char* variant = locale.getVariant();
+
+ std::string result =
+ (language != NULL && *language != '\0') ? language : "und";
+
+ if (country != NULL && *country != '\0') {
+ result += '-';
+ result += country;
+ }
+
+ if (variant != NULL && *variant != '\0') {
+ std::string variant_str(variant);
+ StringToLowerASCII(&variant_str);
+ result += '@' + variant_str;
+ }
+
+ return result;
+}
+
// Convert the ICU default locale to a string.
std::string GetConfiguredLocale() {
return GetLocaleString(icu::Locale::getDefault());
}
-// Convert the ICU canonicalized locale to a string.
-std::string GetCanonicalLocale(const char* locale) {
- return GetLocaleString(icu::Locale::createCanonical(locale));
-}
-
// Convert Chrome locale name to ICU locale name
std::string ICULocaleName(const std::string& locale_string) {
// If not Spanish, just return it.
« base/i18n/rtl.h ('K') | « base/i18n/rtl.h ('k') | ui/base/l10n/l10n_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698