| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/l10n/l10n_util.h" | 5 #include "ui/base/l10n/l10n_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cstdlib> | 8 #include <cstdlib> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/i18n/file_util_icu.h" | 16 #include "base/i18n/file_util_icu.h" |
| 17 #include "base/i18n/message_formatter.h" | 17 #include "base/i18n/message_formatter.h" |
| 18 #include "base/i18n/number_formatting.h" |
| 18 #include "base/i18n/rtl.h" | 19 #include "base/i18n/rtl.h" |
| 19 #include "base/i18n/string_compare.h" | 20 #include "base/i18n/string_compare.h" |
| 20 #include "base/lazy_instance.h" | 21 #include "base/lazy_instance.h" |
| 21 #include "base/macros.h" | 22 #include "base/macros.h" |
| 22 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 23 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
| 24 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
| 25 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
| 26 #include "base/strings/sys_string_conversions.h" | 27 #include "base/strings/sys_string_conversions.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 28 #include "base/strings/utf_string_conversions.h" |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 const base::string16& a, | 824 const base::string16& a, |
| 824 const base::string16& b, | 825 const base::string16& b, |
| 825 std::vector<size_t>* offsets) { | 826 std::vector<size_t>* offsets) { |
| 826 std::vector<base::string16> replacements; | 827 std::vector<base::string16> replacements; |
| 827 replacements.push_back(a); | 828 replacements.push_back(a); |
| 828 replacements.push_back(b); | 829 replacements.push_back(b); |
| 829 return GetStringFUTF16(message_id, replacements, offsets); | 830 return GetStringFUTF16(message_id, replacements, offsets); |
| 830 } | 831 } |
| 831 | 832 |
| 832 base::string16 GetStringFUTF16Int(int message_id, int a) { | 833 base::string16 GetStringFUTF16Int(int message_id, int a) { |
| 833 return GetStringFUTF16(message_id, base::UTF8ToUTF16(base::IntToString(a))); | 834 return GetStringFUTF16(message_id, base::FormatNumber(a)); |
| 834 } | 835 } |
| 835 | 836 |
| 836 base::string16 GetStringFUTF16Int(int message_id, int64_t a) { | 837 base::string16 GetStringFUTF16Int(int message_id, int64_t a) { |
| 837 return GetStringFUTF16(message_id, base::UTF8ToUTF16(base::Int64ToString(a))); | 838 return GetStringFUTF16(message_id, base::FormatNumber(a)); |
| 838 } | 839 } |
| 839 | 840 |
| 840 base::string16 GetPluralStringFUTF16(int message_id, int number) { | 841 base::string16 GetPluralStringFUTF16(int message_id, int number) { |
| 841 return base::i18n::MessageFormatter::FormatWithNumberedArgs( | 842 return base::i18n::MessageFormatter::FormatWithNumberedArgs( |
| 842 GetStringUTF16(message_id), number); | 843 GetStringUTF16(message_id), number); |
| 843 } | 844 } |
| 844 | 845 |
| 845 std::string GetPluralStringFUTF8(int message_id, int number) { | 846 std::string GetPluralStringFUTF8(int message_id, int number) { |
| 846 return base::UTF16ToUTF8(GetPluralStringFUTF16(message_id, number)); | 847 return base::UTF16ToUTF8(GetPluralStringFUTF16(message_id, number)); |
| 847 } | 848 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 882 | 883 |
| 883 const char* const* GetAcceptLanguageListForTesting() { | 884 const char* const* GetAcceptLanguageListForTesting() { |
| 884 return kAcceptLanguageList; | 885 return kAcceptLanguageList; |
| 885 } | 886 } |
| 886 | 887 |
| 887 size_t GetAcceptLanguageListSizeForTesting() { | 888 size_t GetAcceptLanguageListSizeForTesting() { |
| 888 return arraysize(kAcceptLanguageList); | 889 return arraysize(kAcceptLanguageList); |
| 889 } | 890 } |
| 890 | 891 |
| 891 } // namespace l10n_util | 892 } // namespace l10n_util |
| OLD | NEW |