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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // accepted, but 'z', 'German', 'en-$1', or 'abcd-1234' should not. | 83 // accepted, but 'z', 'German', 'en-$1', or 'abcd-1234' should not. |
84 // Case-insensitive. Based on BCP 47, see: | 84 // Case-insensitive. Based on BCP 47, see: |
85 // http://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers | 85 // http://unicode.org/reports/tr35/#Unicode_Language_and_Locale_Identifiers |
86 UI_BASE_EXPORT bool IsValidLocaleSyntax(const std::string& locale); | 86 UI_BASE_EXPORT bool IsValidLocaleSyntax(const std::string& locale); |
87 | 87 |
88 // | 88 // |
89 // Mac Note: See l10n_util_mac.h for some NSString versions and other support. | 89 // Mac Note: See l10n_util_mac.h for some NSString versions and other support. |
90 // | 90 // |
91 | 91 |
92 // Pulls resource string from the string bundle and returns it. | 92 // Pulls resource string from the string bundle and returns it. |
| 93 // On Linux, RLM (right-to-left mark) is prepended to the string if |
| 94 // the locale is RTL and the string starts with a strong LTR character |
| 95 // but contains strong RTL characters. These functions require ICU to |
| 96 // be initialized on Linux/Chrome OS. |
93 UI_BASE_EXPORT std::string GetStringUTF8(int message_id); | 97 UI_BASE_EXPORT std::string GetStringUTF8(int message_id); |
94 UI_BASE_EXPORT base::string16 GetStringUTF16(int message_id); | 98 UI_BASE_EXPORT base::string16 GetStringUTF16(int message_id); |
95 | 99 |
| 100 // The same as above but without any RTL adjustment. Use it for |
| 101 // reading the default value of a preference. |
| 102 UI_BASE_EXPORT std::string GetStringUTF8Raw(int message_id); |
| 103 |
96 // Get a resource string and replace $i with replacements[i] for all | 104 // Get a resource string and replace $i with replacements[i] for all |
97 // i < replacements.size(). Additionally, $$ is replaced by $. | 105 // i < replacements.size(). Additionally, $$ is replaced by $. |
98 // If non-NULL |offsets| will be replaced with the start points of the replaced | 106 // If non-NULL |offsets| will be replaced with the start points of the replaced |
99 // strings. | 107 // strings. |
100 UI_BASE_EXPORT base::string16 GetStringFUTF16( | 108 UI_BASE_EXPORT base::string16 GetStringFUTF16( |
101 int message_id, | 109 int message_id, |
102 const std::vector<base::string16>& replacements, | 110 const std::vector<base::string16>& replacements, |
103 std::vector<size_t>* offsets); | 111 std::vector<size_t>* offsets); |
104 | 112 |
105 // Convenience wrappers for the above. | 113 // Convenience wrappers for the above. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 const std::string& display_locale, | 186 const std::string& display_locale, |
179 std::vector<std::string>* locale_codes); | 187 std::vector<std::string>* locale_codes); |
180 | 188 |
181 // Returns the preferred size of the contents view of a window based on | 189 // Returns the preferred size of the contents view of a window based on |
182 // designer given constraints which might dependent on the language used. | 190 // designer given constraints which might dependent on the language used. |
183 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); | 191 UI_BASE_EXPORT int GetLocalizedContentsWidthInPixels(int pixel_resource_id); |
184 | 192 |
185 } // namespace l10n_util | 193 } // namespace l10n_util |
186 | 194 |
187 #endif // UI_BASE_L10N_L10N_UTIL_H_ | 195 #endif // UI_BASE_L10N_L10N_UTIL_H_ |
OLD | NEW |