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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 // it returns "French". To get the display name of | 44 // it returns "French". To get the display name of |
45 // |locale| in the UI language of Chrome, |display_locale| can be | 45 // |locale| in the UI language of Chrome, |display_locale| can be |
46 // set to the return value of g_browser_process->GetApplicationLocale() | 46 // set to the return value of g_browser_process->GetApplicationLocale() |
47 // in the UI thread. | 47 // in the UI thread. |
48 // If |is_for_ui| is true, U+200F is appended so that it can be | 48 // If |is_for_ui| is true, U+200F is appended so that it can be |
49 // rendered properly in a RTL Chrome. | 49 // rendered properly in a RTL Chrome. |
50 UI_EXPORT string16 GetDisplayNameForLocale(const std::string& locale, | 50 UI_EXPORT string16 GetDisplayNameForLocale(const std::string& locale, |
51 const std::string& display_locale, | 51 const std::string& display_locale, |
52 bool is_for_ui); | 52 bool is_for_ui); |
53 | 53 |
| 54 // Returns the display name of the |country_code| in |display_locale|. |
| 55 UI_EXPORT string16 GetDisplayNameForCountry(const std::string& country_code, |
| 56 const std::string& display_locale); |
| 57 |
54 // Converts all - into _, to be consistent with ICU and file system names. | 58 // Converts all - into _, to be consistent with ICU and file system names. |
55 UI_EXPORT std::string NormalizeLocale(const std::string& locale); | 59 UI_EXPORT std::string NormalizeLocale(const std::string& locale); |
56 | 60 |
57 // Produce a vector of parent locales for given locale. | 61 // Produce a vector of parent locales for given locale. |
58 // It includes the current locale in the result. | 62 // It includes the current locale in the result. |
59 // sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr. | 63 // sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr. |
60 UI_EXPORT void GetParentLocales(const std::string& current_locale, | 64 UI_EXPORT void GetParentLocales(const std::string& current_locale, |
61 std::vector<std::string>* parent_locales); | 65 std::vector<std::string>* parent_locales); |
62 | 66 |
63 // Checks if a string is plausibly a syntactically-valid locale string, | 67 // Checks if a string is plausibly a syntactically-valid locale string, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 | 145 |
142 // Returns a vector of locale codes usable for accept-languages. | 146 // Returns a vector of locale codes usable for accept-languages. |
143 UI_EXPORT void GetAcceptLanguagesForLocale( | 147 UI_EXPORT void GetAcceptLanguagesForLocale( |
144 const std::string& display_locale, | 148 const std::string& display_locale, |
145 std::vector<std::string>* locale_codes); | 149 std::vector<std::string>* locale_codes); |
146 | 150 |
147 | 151 |
148 } // namespace l10n_util | 152 } // namespace l10n_util |
149 | 153 |
150 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 154 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
OLD | NEW |