OLD | NEW |
1 // Copyright (c) 2012 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 |
11 | 11 |
(...skipping 32 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 | |
58 // Converts all - into _, to be consistent with ICU and file system names. | 54 // Converts all - into _, to be consistent with ICU and file system names. |
59 UI_EXPORT std::string NormalizeLocale(const std::string& locale); | 55 UI_EXPORT std::string NormalizeLocale(const std::string& locale); |
60 | 56 |
61 // Produce a vector of parent locales for given locale. | 57 // Produce a vector of parent locales for given locale. |
62 // It includes the current locale in the result. | 58 // It includes the current locale in the result. |
63 // sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr. | 59 // sr_Cyrl_RS generates sr_Cyrl_RS, sr_Cyrl and sr. |
64 UI_EXPORT void GetParentLocales(const std::string& current_locale, | 60 UI_EXPORT void GetParentLocales(const std::string& current_locale, |
65 std::vector<std::string>* parent_locales); | 61 std::vector<std::string>* parent_locales); |
66 | 62 |
67 // Checks if a string is plausibly a syntactically-valid locale string, | 63 // Checks if a string is plausibly a syntactically-valid locale string, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 | 141 |
146 // Returns a vector of locale codes usable for accept-languages. | 142 // Returns a vector of locale codes usable for accept-languages. |
147 UI_EXPORT void GetAcceptLanguagesForLocale( | 143 UI_EXPORT void GetAcceptLanguagesForLocale( |
148 const std::string& display_locale, | 144 const std::string& display_locale, |
149 std::vector<std::string>* locale_codes); | 145 std::vector<std::string>* locale_codes); |
150 | 146 |
151 | 147 |
152 } // namespace l10n_util | 148 } // namespace l10n_util |
153 | 149 |
154 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 150 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
OLD | NEW |