Chromium Code Reviews| Index: ui/base/l10n/l10n_util.cc |
| diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc |
| index 9dfe573dc43c8377060850ef1aff5f7bdea8359d..4d63a47967b430a20891fb345ecab4d523feccfb 100644 |
| --- a/ui/base/l10n/l10n_util.cc |
| +++ b/ui/base/l10n/l10n_util.cc |
| @@ -699,23 +699,21 @@ base::string16 GetStringFUTF16(int message_id, |
| // check as the code may simply want to find the placeholders rather than |
| // actually replacing them. |
| if (!offsets) { |
| - std::string utf8_string = base::UTF16ToUTF8(format_string); |
| - |
| // $9 is the highest allowed placeholder. |
| for (size_t i = 0; i < 9; ++i) { |
| bool placeholder_should_exist = replacements.size() > i; |
| - std::string placeholder = |
| - base::StringPrintf("$%d", static_cast<int>(i + 1)); |
| - size_t pos = utf8_string.find(placeholder.c_str()); |
| + base::string16 placeholder = base::ASCIIToUTF16("$"); |
| + placeholder += (L'1' + i); |
|
Lei Zhang
2016/05/25 00:07:02
At least Linux didn't like having this as part of
jungshik at Google
2016/05/25 07:37:05
|L'1'| is wchar_t (32-bit) on Linux/Mac. Didn't yo
jungshik at Google
2016/05/25 08:26:34
oh. trybots all come back green.
|
| + size_t pos = format_string.find(placeholder); |
| if (placeholder_should_exist) { |
| - DCHECK_NE(std::string::npos, pos) << |
| - " Didn't find a " << placeholder << " placeholder in " << |
| - utf8_string; |
| + DCHECK_NE(std::string::npos, pos) << " Didn't find a " << placeholder |
|
Lei Zhang
2016/05/25 00:07:02
This is just "git cl format" lining things up.
|
| + << " placeholder in " |
| + << format_string; |
| } else { |
| - DCHECK_EQ(std::string::npos, pos) << |
| - " Unexpectedly found a " << placeholder << " placeholder in " << |
| - utf8_string; |
| + DCHECK_EQ(std::string::npos, pos) << " Unexpectedly found a " |
| + << placeholder << " placeholder in " |
| + << format_string; |
| } |
| } |
| } |
| @@ -865,10 +863,11 @@ void GetAcceptLanguagesForLocale(const std::string& display_locale, |
| std::vector<std::string>* locale_codes) { |
| for (size_t i = 0; i < arraysize(kAcceptLanguageList); ++i) { |
| if (!l10n_util::IsLocaleNameTranslated(kAcceptLanguageList[i], |
| - display_locale)) |
| - // TODO(jungshik) : Put them at the of the list with language codes |
| + display_locale)) { |
| + // TODO(jungshik) : Put them at the end of the list with language codes |
|
Lei Zhang
2016/05/25 00:07:03
I think that's what you meant to say?
|
| // enclosed by brackets instead of skipping. |
| - continue; |
| + continue; |
| + } |
| locale_codes->push_back(kAcceptLanguageList[i]); |
| } |
| } |