OLD | NEW |
1 // Copyright (c) 2011 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 #ifndef BASE_I18N_RTL_H_ | 5 #ifndef BASE_I18N_RTL_H_ |
6 #define BASE_I18N_RTL_H_ | 6 #define BASE_I18N_RTL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Returns true if the application text direction is right-to-left. | 54 // Returns true if the application text direction is right-to-left. |
55 BASE_I18N_EXPORT bool IsRTL(); | 55 BASE_I18N_EXPORT bool IsRTL(); |
56 | 56 |
57 // Returns whether the text direction for the default ICU locale is RTL. This | 57 // Returns whether the text direction for the default ICU locale is RTL. This |
58 // assumes that SetICUDefaultLocale has been called to set the default locale to | 58 // assumes that SetICUDefaultLocale has been called to set the default locale to |
59 // the UI locale of Chrome. | 59 // the UI locale of Chrome. |
60 // NOTE: Generally, you should call IsRTL() instead of this. | 60 // NOTE: Generally, you should call IsRTL() instead of this. |
61 BASE_I18N_EXPORT bool ICUIsRTL(); | 61 BASE_I18N_EXPORT bool ICUIsRTL(); |
62 | 62 |
63 // Returns the text direction for |locale_name|. | 63 // Returns the text direction for |locale_name|. |
| 64 // As a startup optimization, this method checks the locale against a list of |
| 65 // Chrome-supported RTL locales. |
| 66 BASE_I18N_EXPORT TextDirection |
| 67 GetTextDirectionForLocaleInStartUp(const char* locale_name); |
| 68 |
| 69 // Returns the text direction for |locale_name|. |
64 BASE_I18N_EXPORT TextDirection GetTextDirectionForLocale( | 70 BASE_I18N_EXPORT TextDirection GetTextDirectionForLocale( |
65 const char* locale_name); | 71 const char* locale_name); |
66 | 72 |
67 // Given the string in |text|, returns the directionality of the first or last | 73 // Given the string in |text|, returns the directionality of the first or last |
68 // character with strong directionality in the string. If no character in the | 74 // character with strong directionality in the string. If no character in the |
69 // text has strong directionality, LEFT_TO_RIGHT is returned. The Bidi | 75 // text has strong directionality, LEFT_TO_RIGHT is returned. The Bidi |
70 // character types L, LRE, LRO, R, AL, RLE, and RLO are considered as strong | 76 // character types L, LRE, LRO, R, AL, RLE, and RLO are considered as strong |
71 // directionality characters. Please refer to http://unicode.org/reports/tr9/ | 77 // directionality characters. Please refer to http://unicode.org/reports/tr9/ |
72 // for more information. | 78 // for more information. |
73 BASE_I18N_EXPORT TextDirection GetFirstStrongCharacterDirection( | 79 BASE_I18N_EXPORT TextDirection GetFirstStrongCharacterDirection( |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 // return the text itself. Explicit bidi control characters display and have | 146 // return the text itself. Explicit bidi control characters display and have |
141 // semantic effect. They can be deleted so they might not always appear in a | 147 // semantic effect. They can be deleted so they might not always appear in a |
142 // pair. | 148 // pair. |
143 BASE_I18N_EXPORT string16 StripWrappingBidiControlCharacters( | 149 BASE_I18N_EXPORT string16 StripWrappingBidiControlCharacters( |
144 const string16& text) WARN_UNUSED_RESULT; | 150 const string16& text) WARN_UNUSED_RESULT; |
145 | 151 |
146 } // namespace i18n | 152 } // namespace i18n |
147 } // namespace base | 153 } // namespace base |
148 | 154 |
149 #endif // BASE_I18N_RTL_H_ | 155 #endif // BASE_I18N_RTL_H_ |
OLD | NEW |