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 |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/strings/string_util.h" | 15 #include "base/strings/string_util.h" |
16 #include "ui/base/ui_base_export.h" | 16 #include "ui/base/ui_base_export.h" |
17 | 17 |
18 #if defined(OS_MACOSX) | 18 #if defined(OS_MACOSX) |
19 #include "ui/base/l10n/l10n_util_mac.h" | 19 #include "ui/base/l10n/l10n_util_mac.h" |
20 #endif // OS_MACOSX | 20 #endif // OS_MACOSX |
21 | 21 |
22 namespace l10n_util { | 22 namespace l10n_util { |
23 | 23 |
| 24 // The same as base::i18n::GetCanonicalLocale(const char*), but takes |
| 25 // std::string as an argument. |
| 26 std::string GetCanonicalLocale(const std::string& locale); |
| 27 |
24 // This method translates a generic locale name to one of the locally defined | 28 // This method translates a generic locale name to one of the locally defined |
25 // ones. This method returns true if it succeeds. | 29 // ones. This method returns true if it succeeds. |
26 UI_BASE_EXPORT bool CheckAndResolveLocale(const std::string& locale, | 30 UI_BASE_EXPORT bool CheckAndResolveLocale(const std::string& locale, |
27 std::string* resolved_locale); | 31 std::string* resolved_locale); |
28 | 32 |
29 // This method is responsible for determining the locale as defined below. In | 33 // This method is responsible for determining the locale as defined below. In |
30 // nearly all cases you shouldn't call this, rather use GetApplicationLocale | 34 // nearly all cases you shouldn't call this, rather use GetApplicationLocale |
31 // defined on browser_process. | 35 // defined on browser_process. |
32 // | 36 // |
33 // Returns the locale used by the Application. First we use the value from the | 37 // Returns the locale used by the Application. First we use the value from the |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const std::string& display_locale, | 182 const std::string& display_locale, |
179 std::vector<std::string>* locale_codes); | 183 std::vector<std::string>* locale_codes); |
180 | 184 |
181 // Returns the preferred size of the contents view of a window based on | 185 // Returns the preferred size of the contents view of a window based on |
182 // designer given constraints which might dependent on the language used. | 186 // designer given constraints which might dependent on the language used. |
183 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); | 187 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); |
184 | 188 |
185 } // namespace l10n_util | 189 } // namespace l10n_util |
186 | 190 |
187 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 191 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
OLD | NEW |