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 // 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 | 10 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 UI_BASE_EXPORT base::string16 GetStringFUTF16Int(int message_id, int a); | 162 UI_BASE_EXPORT base::string16 GetStringFUTF16Int(int message_id, int a); |
163 base::string16 GetStringFUTF16Int(int message_id, int64 a); | 163 base::string16 GetStringFUTF16Int(int message_id, int64 a); |
164 | 164 |
165 // Get a resource string using |number| with a locale-specific plural rule. | 165 // Get a resource string using |number| with a locale-specific plural rule. |
166 // |message_id| points to a message in the ICU syntax. | 166 // |message_id| points to a message in the ICU syntax. |
167 // See http://userguide.icu-project.org/formatparse/messages and | 167 // See http://userguide.icu-project.org/formatparse/messages and |
168 // go/plurals (Google internal). | 168 // go/plurals (Google internal). |
169 UI_BASE_EXPORT base::string16 GetPluralStringFUTF16(int message_id, int number); | 169 UI_BASE_EXPORT base::string16 GetPluralStringFUTF16(int message_id, int number); |
170 UI_BASE_EXPORT std::string GetPluralStringFUTF8(int message_id, int number); | 170 UI_BASE_EXPORT std::string GetPluralStringFUTF8(int message_id, int number); |
171 | 171 |
| 172 // Get a string when you only care about 'single vs multiple' distinction. |
| 173 // The message pointed to by |message_id| should be in ICU syntax |
| 174 // (see the references above for Plural) with 'single', 'multiple', and |
| 175 // 'other' (fallback) instead of 'male', 'female', and 'other' (fallback). |
| 176 UI_BASE_EXPORT base::string16 GetSingleOrMultipleStringUTF16(int message_id, |
| 177 bool is_multiple); |
| 178 |
172 // In place sorting of base::string16 strings using collation rules for | 179 // In place sorting of base::string16 strings using collation rules for |
173 // |locale|. | 180 // |locale|. |
174 UI_BASE_EXPORT void SortStrings16(const std::string& locale, | 181 UI_BASE_EXPORT void SortStrings16(const std::string& locale, |
175 std::vector<base::string16>* strings); | 182 std::vector<base::string16>* strings); |
176 | 183 |
177 // Returns a vector of available locale codes. E.g., a vector containing | 184 // Returns a vector of available locale codes. E.g., a vector containing |
178 // en-US, es, fr, fi, pt-PT, pt-BR, etc. | 185 // en-US, es, fr, fi, pt-PT, pt-BR, etc. |
179 UI_BASE_EXPORT const std::vector<std::string>& GetAvailableLocales(); | 186 UI_BASE_EXPORT const std::vector<std::string>& GetAvailableLocales(); |
180 | 187 |
181 // Returns a vector of locale codes usable for accept-languages. | 188 // Returns a vector of locale codes usable for accept-languages. |
182 UI_BASE_EXPORT void GetAcceptLanguagesForLocale( | 189 UI_BASE_EXPORT void GetAcceptLanguagesForLocale( |
183 const std::string& display_locale, | 190 const std::string& display_locale, |
184 std::vector<std::string>* locale_codes); | 191 std::vector<std::string>* locale_codes); |
185 | 192 |
186 // Returns the preferred size of the contents view of a window based on | 193 // Returns the preferred size of the contents view of a window based on |
187 // designer given constraints which might dependent on the language used. | 194 // designer given constraints which might dependent on the language used. |
188 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); | 195 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); |
189 | 196 |
190 UI_BASE_EXPORT const char* const* GetAcceptLanguageListForTesting(); | 197 UI_BASE_EXPORT const char* const* GetAcceptLanguageListForTesting(); |
191 | 198 |
192 UI_BASE_EXPORT size_t GetAcceptLanguageListSizeForTesting(); | 199 UI_BASE_EXPORT size_t GetAcceptLanguageListSizeForTesting(); |
193 | 200 |
194 } // namespace l10n_util | 201 } // namespace l10n_util |
195 | 202 |
196 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 203 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
OLD | NEW |