Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 std::string* resolved_locale); | 33 std::string* resolved_locale); |
| 34 | 34 |
| 35 // This method is responsible for determining the locale as defined below. In | 35 // This method is responsible for determining the locale as defined below. In |
| 36 // nearly all cases you shouldn't call this, rather use GetApplicationLocale | 36 // nearly all cases you shouldn't call this, rather use GetApplicationLocale |
| 37 // defined on browser_process. | 37 // defined on browser_process. |
| 38 // | 38 // |
| 39 // Returns the locale used by the Application. First we use the value from the | 39 // Returns the locale used by the Application. First we use the value from the |
| 40 // command line (--lang), second we try the value in the prefs file (passed in | 40 // command line (--lang), second we try the value in the prefs file (passed in |
| 41 // as |pref_locale|), finally, we fall back on the system locale. We only return | 41 // as |pref_locale|), finally, we fall back on the system locale. We only return |
| 42 // a value if there's a corresponding resource DLL for the locale. Otherwise, | 42 // a value if there's a corresponding resource DLL for the locale. Otherwise, |
| 43 // we fall back to en-us. | 43 // we fall back to en-us. |set_icu_locale| determines whether the resulting |
| 44 // locale is set as the default ICU locale before returning it. | |
| 45 UI_BASE_EXPORT std::string GetApplicationLocale(const std::string& pref_locale, | |
| 46 bool set_icu_locale); | |
| 47 | |
| 48 // Convenience version of GetApplicationLocale() that sets the resulting locale | |
| 49 // as the default ICU locale before returning it. | |
| 44 UI_BASE_EXPORT std::string GetApplicationLocale(const std::string& pref_locale); | 50 UI_BASE_EXPORT std::string GetApplicationLocale(const std::string& pref_locale); |
|
pneubeck (no reviews)
2014/08/19 15:09:30
just for consideration:
shouldn't this be renamed
bartfab (slow)
2014/08/19 17:03:02
I agree. It came as a very nasty surprise to me th
| |
| 45 | 51 |
| 46 // Returns true if a display name for |locale| is available in the locale | 52 // Returns true if a display name for |locale| is available in the locale |
| 47 // |display_locale|. | 53 // |display_locale|. |
| 48 UI_BASE_EXPORT bool IsLocaleNameTranslated(const char* locale, | 54 UI_BASE_EXPORT bool IsLocaleNameTranslated(const char* locale, |
| 49 const std::string& display_locale); | 55 const std::string& display_locale); |
| 50 | 56 |
| 51 // Given a locale code, return true if the OS is capable of supporting it. | 57 // Given a locale code, return true if the OS is capable of supporting it. |
| 52 // For instance, Oriya is not well supported on Windows XP and we return | 58 // For instance, Oriya is not well supported on Windows XP and we return |
| 53 // false for "or". | 59 // false for "or". |
| 54 bool IsLocaleSupportedByOS(const std::string& locale); | 60 bool IsLocaleSupportedByOS(const std::string& locale); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 // designer given constraints which might dependent on the language used. | 194 // designer given constraints which might dependent on the language used. |
| 189 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); | 195 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); |
| 190 | 196 |
| 191 UI_BASE_EXPORT const char* const* GetAcceptLanguageListForTesting(); | 197 UI_BASE_EXPORT const char* const* GetAcceptLanguageListForTesting(); |
| 192 | 198 |
| 193 UI_BASE_EXPORT size_t GetAcceptLanguageListSizeForTesting(); | 199 UI_BASE_EXPORT size_t GetAcceptLanguageListSizeForTesting(); |
| 194 | 200 |
| 195 } // namespace l10n_util | 201 } // namespace l10n_util |
| 196 | 202 |
| 197 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 203 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
| OLD | NEW |