| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 size_t* offset); | 155 size_t* offset); |
| 156 UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, | 156 UI_BASE_EXPORT base::string16 GetStringFUTF16(int message_id, |
| 157 const base::string16& a, | 157 const base::string16& a, |
| 158 const base::string16& b, | 158 const base::string16& b, |
| 159 std::vector<size_t>* offsets); | 159 std::vector<size_t>* offsets); |
| 160 | 160 |
| 161 // Convenience functions to get a string with a single number as a parameter. | 161 // Convenience functions to get a string with a single number as a parameter. |
| 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| to decide which of |message_ids| should | 165 // Get a resource string using |number| with a locale-specific plural rule. |
| 166 // be used. |message_ids| must be size 6 and in order: default, singular, zero, | 166 // |message_id| points to a message in the ICU syntax. |
| 167 // two, few, many. | 167 // See http://userguide.icu-project.org/formatparse/messages and |
| 168 UI_BASE_EXPORT base::string16 GetPluralStringFUTF16( | 168 // go/plurals (Google internal). |
| 169 const std::vector<int>& message_ids, | 169 UI_BASE_EXPORT base::string16 GetPluralStringFUTF16(int message_id, int number); |
| 170 int number); | 170 UI_BASE_EXPORT std::string GetPluralStringFUTF8(int message_id, int number); |
| 171 UI_BASE_EXPORT std::string GetPluralStringFUTF8( | |
| 172 const std::vector<int>& message_ids, | |
| 173 int number); | |
| 174 | 171 |
| 175 // In place sorting of base::string16 strings using collation rules for | 172 // In place sorting of base::string16 strings using collation rules for |
| 176 // |locale|. | 173 // |locale|. |
| 177 UI_BASE_EXPORT void SortStrings16(const std::string& locale, | 174 UI_BASE_EXPORT void SortStrings16(const std::string& locale, |
| 178 std::vector<base::string16>* strings); | 175 std::vector<base::string16>* strings); |
| 179 | 176 |
| 180 // Returns a vector of available locale codes. E.g., a vector containing | 177 // Returns a vector of available locale codes. E.g., a vector containing |
| 181 // en-US, es, fr, fi, pt-PT, pt-BR, etc. | 178 // en-US, es, fr, fi, pt-PT, pt-BR, etc. |
| 182 UI_BASE_EXPORT const std::vector<std::string>& GetAvailableLocales(); | 179 UI_BASE_EXPORT const std::vector<std::string>& GetAvailableLocales(); |
| 183 | 180 |
| 184 // Returns a vector of locale codes usable for accept-languages. | 181 // Returns a vector of locale codes usable for accept-languages. |
| 185 UI_BASE_EXPORT void GetAcceptLanguagesForLocale( | 182 UI_BASE_EXPORT void GetAcceptLanguagesForLocale( |
| 186 const std::string& display_locale, | 183 const std::string& display_locale, |
| 187 std::vector<std::string>* locale_codes); | 184 std::vector<std::string>* locale_codes); |
| 188 | 185 |
| 189 // Returns the preferred size of the contents view of a window based on | 186 // Returns the preferred size of the contents view of a window based on |
| 190 // designer given constraints which might dependent on the language used. | 187 // designer given constraints which might dependent on the language used. |
| 191 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); | 188 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); |
| 192 | 189 |
| 193 UI_BASE_EXPORT const char* const* GetAcceptLanguageListForTesting(); | 190 UI_BASE_EXPORT const char* const* GetAcceptLanguageListForTesting(); |
| 194 | 191 |
| 195 UI_BASE_EXPORT size_t GetAcceptLanguageListSizeForTesting(); | 192 UI_BASE_EXPORT size_t GetAcceptLanguageListSizeForTesting(); |
| 196 | 193 |
| 197 } // namespace l10n_util | 194 } // namespace l10n_util |
| 198 | 195 |
| 199 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 196 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
| OLD | NEW |