| Index: ui/base/l10n/l10n_util.cc
|
| diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc
|
| index 3757d2f3dc58f0d1f4758b1356018a93a7704cae..b610e9662d5e662694f6c67d1e48aad81ca52e63 100644
|
| --- a/ui/base/l10n/l10n_util.cc
|
| +++ b/ui/base/l10n/l10n_util.cc
|
| @@ -253,11 +253,12 @@ bool IsLocaleAvailable(const std::string& locale) {
|
| // means text such as "Google Chrome foo bar..." will be layed out LTR even
|
| // if "foo bar" is RTL. So this function prepends the necessary RLM in such
|
| // cases.
|
| -void AdjustParagraphDirectionality(string16* paragraph) {
|
| +void AdjustParagraphDirectionality(base::string16* paragraph) {
|
| #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID)
|
| if (base::i18n::IsRTL() &&
|
| base::i18n::StringContainsStrongRTLChars(*paragraph)) {
|
| - paragraph->insert(0, 1, static_cast<char16>(base::i18n::kRightToLeftMark));
|
| + paragraph->insert(0, 1,
|
| + static_cast<base::char16>(base::i18n::kRightToLeftMark));
|
| }
|
| #endif
|
| }
|
| @@ -498,7 +499,7 @@ std::string GetApplicationLocale(const std::string& pref_locale) {
|
|
|
| bool IsLocaleNameTranslated(const char* locale,
|
| const std::string& display_locale) {
|
| - string16 display_name =
|
| + base::string16 display_name =
|
| l10n_util::GetDisplayNameForLocale(locale, display_locale, false);
|
| // Because ICU sets the error code to U_USING_DEFAULT_WARNING whether or not
|
| // uloc_getDisplayName returns the actual translation or the default
|
| @@ -509,9 +510,9 @@ bool IsLocaleNameTranslated(const char* locale,
|
| return !IsStringASCII(display_name) || UTF16ToASCII(display_name) != locale;
|
| }
|
|
|
| -string16 GetDisplayNameForLocale(const std::string& locale,
|
| - const std::string& display_locale,
|
| - bool is_for_ui) {
|
| +base::string16 GetDisplayNameForLocale(const std::string& locale,
|
| + const std::string& display_locale,
|
| + bool is_for_ui) {
|
| std::string locale_code = locale;
|
| // Internally, we use the language code of zh-CN and zh-TW, but we want the
|
| // display names to be Chinese (Simplified) and Chinese (Traditional) instead
|
| @@ -534,7 +535,7 @@ string16 GetDisplayNameForLocale(const std::string& locale,
|
| else if (locale_code == "zh-TW")
|
| locale_code = "zh-Hant";
|
|
|
| - string16 display_name;
|
| + base::string16 display_name;
|
| #if defined(OS_ANDROID)
|
| // Use Java API to get locale display name so that we can remove most of
|
| // the lang data from icu data to reduce binary size, except for zh-Hans and
|
| @@ -562,8 +563,8 @@ string16 GetDisplayNameForLocale(const std::string& locale,
|
| return display_name;
|
| }
|
|
|
| -string16 GetDisplayNameForCountry(const std::string& country_code,
|
| - const std::string& display_locale) {
|
| +base::string16 GetDisplayNameForCountry(const std::string& country_code,
|
| + const std::string& display_locale) {
|
| return GetDisplayNameForLocale("_" + country_code, display_locale, false);
|
| }
|
|
|
| @@ -663,23 +664,23 @@ std::string GetStringUTF8(int message_id) {
|
| return UTF16ToUTF8(GetStringUTF16(message_id));
|
| }
|
|
|
| -string16 GetStringUTF16(int message_id) {
|
| +base::string16 GetStringUTF16(int message_id) {
|
| ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| - string16 str = rb.GetLocalizedString(message_id);
|
| + base::string16 str = rb.GetLocalizedString(message_id);
|
| AdjustParagraphDirectionality(&str);
|
|
|
| return str;
|
| }
|
|
|
| -string16 GetStringFUTF16(int message_id,
|
| - const std::vector<string16>& replacements,
|
| - std::vector<size_t>* offsets) {
|
| +base::string16 GetStringFUTF16(int message_id,
|
| + const std::vector<base::string16>& replacements,
|
| + std::vector<size_t>* offsets) {
|
| // TODO(tc): We could save a string copy if we got the raw string as
|
| // a StringPiece and were able to call ReplaceStringPlaceholders with
|
| - // a StringPiece format string and string16 substitution strings. In
|
| + // a StringPiece format string and base::string16 substitution strings. In
|
| // practice, the strings should be relatively short.
|
| ResourceBundle& rb = ResourceBundle::GetSharedInstance();
|
| - const string16& format_string = rb.GetLocalizedString(message_id);
|
| + const base::string16& format_string = rb.GetLocalizedString(message_id);
|
|
|
| #ifndef NDEBUG
|
| // Make sure every replacement string is being used, so we don't just
|
| @@ -709,69 +710,69 @@ string16 GetStringFUTF16(int message_id,
|
| }
|
| #endif
|
|
|
| - string16 formatted = ReplaceStringPlaceholders(format_string, replacements,
|
| - offsets);
|
| + base::string16 formatted = ReplaceStringPlaceholders(
|
| + format_string, replacements, offsets);
|
| AdjustParagraphDirectionality(&formatted);
|
|
|
| return formatted;
|
| }
|
|
|
| std::string GetStringFUTF8(int message_id,
|
| - const string16& a) {
|
| + const base::string16& a) {
|
| return UTF16ToUTF8(GetStringFUTF16(message_id, a));
|
| }
|
|
|
| std::string GetStringFUTF8(int message_id,
|
| - const string16& a,
|
| - const string16& b) {
|
| + const base::string16& a,
|
| + const base::string16& b) {
|
| return UTF16ToUTF8(GetStringFUTF16(message_id, a, b));
|
| }
|
|
|
| std::string GetStringFUTF8(int message_id,
|
| - const string16& a,
|
| - const string16& b,
|
| - const string16& c) {
|
| + const base::string16& a,
|
| + const base::string16& b,
|
| + const base::string16& c) {
|
| return UTF16ToUTF8(GetStringFUTF16(message_id, a, b, c));
|
| }
|
|
|
| std::string GetStringFUTF8(int message_id,
|
| - const string16& a,
|
| - const string16& b,
|
| - const string16& c,
|
| - const string16& d) {
|
| + const base::string16& a,
|
| + const base::string16& b,
|
| + const base::string16& c,
|
| + const base::string16& d) {
|
| return UTF16ToUTF8(GetStringFUTF16(message_id, a, b, c, d));
|
| }
|
|
|
| -string16 GetStringFUTF16(int message_id,
|
| - const string16& a) {
|
| - std::vector<string16> replacements;
|
| +base::string16 GetStringFUTF16(int message_id,
|
| + const base::string16& a) {
|
| + std::vector<base::string16> replacements;
|
| replacements.push_back(a);
|
| return GetStringFUTF16(message_id, replacements, NULL);
|
| }
|
|
|
| -string16 GetStringFUTF16(int message_id,
|
| - const string16& a,
|
| - const string16& b) {
|
| +base::string16 GetStringFUTF16(int message_id,
|
| + const base::string16& a,
|
| + const base::string16& b) {
|
| return GetStringFUTF16(message_id, a, b, NULL);
|
| }
|
|
|
| -string16 GetStringFUTF16(int message_id,
|
| - const string16& a,
|
| - const string16& b,
|
| - const string16& c) {
|
| - std::vector<string16> replacements;
|
| +base::string16 GetStringFUTF16(int message_id,
|
| + const base::string16& a,
|
| + const base::string16& b,
|
| + const base::string16& c) {
|
| + std::vector<base::string16> replacements;
|
| replacements.push_back(a);
|
| replacements.push_back(b);
|
| replacements.push_back(c);
|
| return GetStringFUTF16(message_id, replacements, NULL);
|
| }
|
|
|
| -string16 GetStringFUTF16(int message_id,
|
| - const string16& a,
|
| - const string16& b,
|
| - const string16& c,
|
| - const string16& d) {
|
| - std::vector<string16> replacements;
|
| +base::string16 GetStringFUTF16(int message_id,
|
| + const base::string16& a,
|
| + const base::string16& b,
|
| + const base::string16& c,
|
| + const base::string16& d) {
|
| + std::vector<base::string16> replacements;
|
| replacements.push_back(a);
|
| replacements.push_back(b);
|
| replacements.push_back(c);
|
| @@ -779,13 +780,13 @@ string16 GetStringFUTF16(int message_id,
|
| return GetStringFUTF16(message_id, replacements, NULL);
|
| }
|
|
|
| -string16 GetStringFUTF16(int message_id,
|
| - const string16& a,
|
| - const string16& b,
|
| - const string16& c,
|
| - const string16& d,
|
| - const string16& e) {
|
| - std::vector<string16> replacements;
|
| +base::string16 GetStringFUTF16(int message_id,
|
| + const base::string16& a,
|
| + const base::string16& b,
|
| + const base::string16& c,
|
| + const base::string16& d,
|
| + const base::string16& e) {
|
| + std::vector<base::string16> replacements;
|
| replacements.push_back(a);
|
| replacements.push_back(b);
|
| replacements.push_back(c);
|
| @@ -794,39 +795,41 @@ string16 GetStringFUTF16(int message_id,
|
| return GetStringFUTF16(message_id, replacements, NULL);
|
| }
|
|
|
| -string16 GetStringFUTF16(int message_id, const string16& a, size_t* offset) {
|
| +base::string16 GetStringFUTF16(int message_id,
|
| + const base::string16& a,
|
| + size_t* offset) {
|
| DCHECK(offset);
|
| std::vector<size_t> offsets;
|
| - std::vector<string16> replacements;
|
| + std::vector<base::string16> replacements;
|
| replacements.push_back(a);
|
| - string16 result = GetStringFUTF16(message_id, replacements, &offsets);
|
| + base::string16 result = GetStringFUTF16(message_id, replacements, &offsets);
|
| DCHECK(offsets.size() == 1);
|
| *offset = offsets[0];
|
| return result;
|
| }
|
|
|
| -string16 GetStringFUTF16(int message_id,
|
| - const string16& a,
|
| - const string16& b,
|
| - std::vector<size_t>* offsets) {
|
| - std::vector<string16> replacements;
|
| +base::string16 GetStringFUTF16(int message_id,
|
| + const base::string16& a,
|
| + const base::string16& b,
|
| + std::vector<size_t>* offsets) {
|
| + std::vector<base::string16> replacements;
|
| replacements.push_back(a);
|
| replacements.push_back(b);
|
| return GetStringFUTF16(message_id, replacements, offsets);
|
| }
|
|
|
| -string16 GetStringFUTF16Int(int message_id, int a) {
|
| +base::string16 GetStringFUTF16Int(int message_id, int a) {
|
| return GetStringFUTF16(message_id, UTF8ToUTF16(base::IntToString(a)));
|
| }
|
|
|
| -string16 GetStringFUTF16Int(int message_id, int64 a) {
|
| +base::string16 GetStringFUTF16Int(int message_id, int64 a) {
|
| return GetStringFUTF16(message_id, UTF8ToUTF16(base::Int64ToString(a)));
|
| }
|
|
|
| -// Specialization of operator() method for string16 version.
|
| +// Specialization of operator() method for base::string16 version.
|
| template <>
|
| -bool StringComparator<string16>::operator()(const string16& lhs,
|
| - const string16& rhs) {
|
| +bool StringComparator<base::string16>::operator()(const base::string16& lhs,
|
| + const base::string16& rhs) {
|
| // If we can not get collator instance for specified locale, just do simple
|
| // string compare.
|
| if (!collator_)
|
| @@ -835,7 +838,7 @@ bool StringComparator<string16>::operator()(const string16& lhs,
|
| UCOL_LESS;
|
| };
|
|
|
| -string16 GetPluralStringFUTF16(const std::vector<int>& message_ids,
|
| +base::string16 GetPluralStringFUTF16(const std::vector<int>& message_ids,
|
| int number) {
|
| scoped_ptr<icu::PluralFormat> format = BuildPluralFormat(message_ids);
|
| DCHECK(format);
|
| @@ -844,7 +847,7 @@ string16 GetPluralStringFUTF16(const std::vector<int>& message_ids,
|
| icu::UnicodeString result_files_string = format->format(number, err);
|
| int capacity = result_files_string.length() + 1;
|
| DCHECK_GT(capacity, 1);
|
| - string16 result;
|
| + base::string16 result;
|
| result_files_string.extract(
|
| static_cast<UChar*>(WriteInto(&result, capacity)), capacity, err);
|
| DCHECK(U_SUCCESS(err));
|
| @@ -857,7 +860,7 @@ std::string GetPluralStringFUTF8(const std::vector<int>& message_ids,
|
| }
|
|
|
| void SortStrings16(const std::string& locale,
|
| - std::vector<string16>* strings) {
|
| + std::vector<base::string16>* strings) {
|
| SortVectorWithStringKey(locale, strings, false);
|
| }
|
|
|
|
|