OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 APP_L10N_UTIL_H_ | 8 #ifndef APP_L10N_UTIL_H_ |
9 #define APP_L10N_UTIL_H_ | 9 #define APP_L10N_UTIL_H_ |
10 #pragma once | 10 #pragma once |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 // Convenience formatters for a single number. | 157 // Convenience formatters for a single number. |
158 std::wstring GetStringF(int message_id, int a); | 158 std::wstring GetStringF(int message_id, int a); |
159 std::wstring GetStringF(int message_id, int64 a); | 159 std::wstring GetStringF(int message_id, int64 a); |
160 | 160 |
161 // Truncates the string to length characters. This breaks the string at | 161 // Truncates the string to length characters. This breaks the string at |
162 // the first word break before length, adding the horizontal ellipsis | 162 // the first word break before length, adding the horizontal ellipsis |
163 // character (unicode character 0x2026) to render ... | 163 // character (unicode character 0x2026) to render ... |
164 // The supplied string is returned if the string has length characters or | 164 // The supplied string is returned if the string has length characters or |
165 // less. | 165 // less. |
166 std::wstring TruncateString(const std::wstring& string, size_t length); | 166 string16 TruncateString(const string16& string, size_t length); |
167 | 167 |
168 // Returns the lower case equivalent of string. | 168 // Returns the lower case equivalent of string. |
169 string16 ToLower(const string16& string); | 169 string16 ToLower(const string16& string); |
170 | 170 |
171 // Returns the upper case equivalent of string. | 171 // Returns the upper case equivalent of string. |
172 string16 ToUpper(const string16& string); | 172 string16 ToUpper(const string16& string); |
173 | 173 |
174 // In place sorting of std::wstring strings using collation rules for |locale|. | 174 // In place sorting of std::wstring strings using collation rules for |locale|. |
175 void SortStrings(const std::string& locale, | 175 void SortStrings(const std::string& locale, |
176 std::vector<std::wstring>* strings); | 176 std::vector<std::wstring>* strings); |
177 | 177 |
178 // In place sorting of string16 strings using collation rules for |locale|. | 178 // In place sorting of string16 strings using collation rules for |locale|. |
179 void SortStrings16(const std::string& locale, | 179 void SortStrings16(const std::string& locale, |
180 std::vector<string16>* strings); | 180 std::vector<string16>* strings); |
181 | 181 |
182 // Returns a vector of available locale codes. E.g., a vector containing | 182 // Returns a vector of available locale codes. E.g., a vector containing |
183 // en-US, es, fr, fi, pt-PT, pt-BR, etc. | 183 // en-US, es, fr, fi, pt-PT, pt-BR, etc. |
184 const std::vector<std::string>& GetAvailableLocales(); | 184 const std::vector<std::string>& GetAvailableLocales(); |
185 | 185 |
186 // Returns a vector of locale codes usable for accept-languages. | 186 // Returns a vector of locale codes usable for accept-languages. |
187 void GetAcceptLanguagesForLocale(const std::string& display_locale, | 187 void GetAcceptLanguagesForLocale(const std::string& display_locale, |
188 std::vector<std::string>* locale_codes); | 188 std::vector<std::string>* locale_codes); |
189 | 189 |
190 | 190 |
191 } // namespace l10n_util | 191 } // namespace l10n_util |
192 | 192 |
193 #endif // APP_L10N_UTIL_H_ | 193 #endif // APP_L10N_UTIL_H_ |
OLD | NEW |