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

Side by Side Diff: base/i18n/rtl.cc

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/i18n/rtl.h" 5 #include "base/i18n/rtl.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 // Represents the locale-specific ICU text direction. 68 // Represents the locale-specific ICU text direction.
69 static TextDirection g_icu_text_direction = UNKNOWN_DIRECTION; 69 static TextDirection g_icu_text_direction = UNKNOWN_DIRECTION;
70 70
71 // Convert the ICU default locale to a string. 71 // Convert the ICU default locale to a string.
72 std::string GetConfiguredLocale() { 72 std::string GetConfiguredLocale() {
73 return GetLocaleString(icu::Locale::getDefault()); 73 return GetLocaleString(icu::Locale::getDefault());
74 } 74 }
75 75
76 // Convert the ICU canonicalized locale to a string. 76 // Convert the ICU canonicalized locale to a string.
77 std::string GetCanonicalLocale(const char* locale) { 77 std::string GetCanonicalLocale(const std::string& locale) {
78 return GetLocaleString(icu::Locale::createCanonical(locale)); 78 return GetLocaleString(icu::Locale::createCanonical(locale.c_str()));
79 } 79 }
80 80
81 // Convert Chrome locale name to ICU locale name 81 // Convert Chrome locale name to ICU locale name
82 std::string ICULocaleName(const std::string& locale_string) { 82 std::string ICULocaleName(const std::string& locale_string) {
83 // If not Spanish, just return it. 83 // If not Spanish, just return it.
84 if (locale_string.substr(0, 2) != "es") 84 if (locale_string.substr(0, 2) != "es")
85 return locale_string; 85 return locale_string;
86 // Expand es to es-ES. 86 // Expand es to es-ES.
87 if (LowerCaseEqualsASCII(locale_string, "es")) 87 if (LowerCaseEqualsASCII(locale_string, "es"))
88 return "es-ES"; 88 return "es-ES";
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 begin == kRightToLeftOverride) 385 begin == kRightToLeftOverride)
386 ++begin_index; 386 ++begin_index;
387 size_t end_index = text.length() - 1; 387 size_t end_index = text.length() - 1;
388 if (text[end_index] == kPopDirectionalFormatting) 388 if (text[end_index] == kPopDirectionalFormatting)
389 --end_index; 389 --end_index;
390 return text.substr(begin_index, end_index - begin_index + 1); 390 return text.substr(begin_index, end_index - begin_index + 1);
391 } 391 }
392 392
393 } // namespace i18n 393 } // namespace i18n
394 } // namespace base 394 } // namespace base
OLDNEW
« no previous file with comments | « base/i18n/rtl.h ('k') | base/ios/weak_nsobject.h » ('j') | shell/BUILD.gn » ('J')

Powered by Google App Engine
This is Rietveld 408576698