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 14 matching lines...) Expand all Loading... |
25 // nearly all cases you shouldn't call this, rather use GetApplicationLocale | 25 // nearly all cases you shouldn't call this, rather use GetApplicationLocale |
26 // defined on browser_process. | 26 // defined on browser_process. |
27 // | 27 // |
28 // Returns the locale used by the Application. First we use the value from the | 28 // Returns the locale used by the Application. First we use the value from the |
29 // command line (--lang), second we try the value in the prefs file (passed in | 29 // command line (--lang), second we try the value in the prefs file (passed in |
30 // as |pref_locale|), finally, we fall back on the system locale. We only return | 30 // as |pref_locale|), finally, we fall back on the system locale. We only return |
31 // a value if there's a corresponding resource DLL for the locale. Otherwise, | 31 // a value if there's a corresponding resource DLL for the locale. Otherwise, |
32 // we fall back to en-us. | 32 // we fall back to en-us. |
33 UI_EXPORT std::string GetApplicationLocale(const std::string& pref_locale); | 33 UI_EXPORT std::string GetApplicationLocale(const std::string& pref_locale); |
34 | 34 |
| 35 // Returns true if a display name for |locale| is available in the locale |
| 36 // |display_locale|. |
| 37 UI_EXPORT bool IsLocaleNameTranslated(const char* locale, |
| 38 const std::string& display_locale); |
| 39 |
35 // Given a locale code, return true if the OS is capable of supporting it. | 40 // Given a locale code, return true if the OS is capable of supporting it. |
36 // For instance, Oriya is not well supported on Windows XP and we return | 41 // For instance, Oriya is not well supported on Windows XP and we return |
37 // false for "or". | 42 // false for "or". |
38 bool IsLocaleSupportedByOS(const std::string& locale); | 43 bool IsLocaleSupportedByOS(const std::string& locale); |
39 | 44 |
40 // This method returns the display name of the locale code in |display_locale|. | 45 // This method returns the display name of the locale code in |display_locale|. |
41 | 46 |
42 // For example, for |locale| = "fr" and |display_locale| = "en", | 47 // For example, for |locale| = "fr" and |display_locale| = "en", |
43 // it returns "French". To get the display name of | 48 // it returns "French". To get the display name of |
44 // |locale| in the UI language of Chrome, |display_locale| can be | 49 // |locale| in the UI language of Chrome, |display_locale| can be |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 const std::string& display_locale, | 152 const std::string& display_locale, |
148 std::vector<std::string>* locale_codes); | 153 std::vector<std::string>* locale_codes); |
149 | 154 |
150 // Returns the preferred size of the contents view of a window based on | 155 // Returns the preferred size of the contents view of a window based on |
151 // designer given constraints which might dependent on the language used. | 156 // designer given constraints which might dependent on the language used. |
152 UI_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); | 157 UI_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); |
153 | 158 |
154 } // namespace l10n_util | 159 } // namespace l10n_util |
155 | 160 |
156 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 161 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
OLD | NEW |