OLD | NEW |
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 // This file contains utility functions for dealing with localized | 5 // This file contains utility functions for dealing with localized |
6 // content. | 6 // content. |
7 | 7 |
8 #ifndef UI_BASE_L10N_L10N_UTIL_H_ | 8 #ifndef UI_BASE_L10N_L10N_UTIL_H_ |
9 #define UI_BASE_L10N_L10N_UTIL_H_ | 9 #define UI_BASE_L10N_L10N_UTIL_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 size_t* offset); | 124 size_t* offset); |
125 UI_EXPORT string16 GetStringFUTF16(int message_id, | 125 UI_EXPORT string16 GetStringFUTF16(int message_id, |
126 const string16& a, | 126 const string16& a, |
127 const string16& b, | 127 const string16& b, |
128 std::vector<size_t>* offsets); | 128 std::vector<size_t>* offsets); |
129 | 129 |
130 // Convenience functions to get a string with a single number as a parameter. | 130 // Convenience functions to get a string with a single number as a parameter. |
131 UI_EXPORT string16 GetStringFUTF16Int(int message_id, int a); | 131 UI_EXPORT string16 GetStringFUTF16Int(int message_id, int a); |
132 string16 GetStringFUTF16Int(int message_id, int64 a); | 132 string16 GetStringFUTF16Int(int message_id, int64 a); |
133 | 133 |
134 // Truncates the string to length characters. This breaks the string at | |
135 // the first word break before length, adding the horizontal ellipsis | |
136 // character (unicode character 0x2026) to render ... | |
137 // The supplied string is returned if the string has length characters or | |
138 // less. | |
139 UI_EXPORT string16 TruncateString(const string16& string, size_t length); | |
140 | |
141 // In place sorting of string16 strings using collation rules for |locale|. | 134 // In place sorting of string16 strings using collation rules for |locale|. |
142 UI_EXPORT void SortStrings16(const std::string& locale, | 135 UI_EXPORT void SortStrings16(const std::string& locale, |
143 std::vector<string16>* strings); | 136 std::vector<string16>* strings); |
144 | 137 |
145 // Returns a vector of available locale codes. E.g., a vector containing | 138 // Returns a vector of available locale codes. E.g., a vector containing |
146 // en-US, es, fr, fi, pt-PT, pt-BR, etc. | 139 // en-US, es, fr, fi, pt-PT, pt-BR, etc. |
147 UI_EXPORT const std::vector<std::string>& GetAvailableLocales(); | 140 UI_EXPORT const std::vector<std::string>& GetAvailableLocales(); |
148 | 141 |
149 // Returns a vector of locale codes usable for accept-languages. | 142 // Returns a vector of locale codes usable for accept-languages. |
150 UI_EXPORT void GetAcceptLanguagesForLocale( | 143 UI_EXPORT void GetAcceptLanguagesForLocale( |
151 const std::string& display_locale, | 144 const std::string& display_locale, |
152 std::vector<std::string>* locale_codes); | 145 std::vector<std::string>* locale_codes); |
153 | 146 |
154 | 147 |
155 } // namespace l10n_util | 148 } // namespace l10n_util |
156 | 149 |
157 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 150 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
OLD | NEW |