Chromium Code Reviews| Index: base/i18n/rtl.cc |
| diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc |
| index 96ef9aaecd257b16b9e8054e90c5421776a5e8c8..efa155ea2b666157966738467f3812aa20759e95 100644 |
| --- a/base/i18n/rtl.cc |
| +++ b/base/i18n/rtl.cc |
| @@ -6,7 +6,6 @@ |
| #include "base/files/file_path.h" |
| #include "base/logging.h" |
| -#include "base/metrics/field_trial.h" |
| #include "base/strings/string_util.h" |
| #include "base/strings/sys_string_conversions.h" |
| #include "base/strings/utf_string_conversions.h" |
| @@ -126,21 +125,28 @@ bool IsRTL() { |
| bool ICUIsRTL() { |
| if (g_icu_text_direction == UNKNOWN_DIRECTION) { |
| const icu::Locale& locale = icu::Locale::getDefault(); |
| - g_icu_text_direction = GetTextDirectionForLocale(locale.getName()); |
| + g_icu_text_direction = GetTextDirectionForLocaleInStartUp(locale.getName()); |
| } |
| return g_icu_text_direction == RIGHT_TO_LEFT; |
| } |
| -TextDirection GetTextDirectionForLocale(const char* locale_name) { |
| - const std::string group_name = |
| - FieldTrialList::FindFullName("LightSpeed"); |
| - // StartsWith allows flexibility for this experiment to apply to multiple |
| - // group names. To start, this will apply to AvoidMMapOnStartup. |
| - if (StartsWith(group_name, "AvoidMMap", CompareCase::SENSITIVE)) { |
| - static const char kEnglishLocale[] = "en_"; |
| - if (StartsWith(locale_name, kEnglishLocale, CompareCase::SENSITIVE)) |
| - return LEFT_TO_RIGHT; |
| +TextDirection GetTextDirectionForLocaleInStartUp(const char* locale_name) { |
| + // This list needs to be updated if we add more RTL locales. |
| + static const char* kRTLLocales[] = { |
| + "ar", |
| + "fa", |
| + "he", |
| + "iw", |
| + "ur" |
| + }; |
| + for (const char* rtl_locale : kRTLLocales) { |
| + if (StartsWith(locale_name, rtl_locale, CompareCase::SENSITIVE)) |
|
jungshik at Google
2015/08/11 20:38:29
One more thing I forgot to mention. Sorry that I d
jungshik at Google
2015/08/11 20:41:59
Because the only 3-letter language code in the cur
danduong
2015/08/11 21:03:16
That was definitely an oversight on my part. Thank
|
| + return RIGHT_TO_LEFT; |
| } |
| + return LEFT_TO_RIGHT; |
| +} |
| + |
| +TextDirection GetTextDirectionForLocale(const char* locale_name) { |
| UErrorCode status = U_ZERO_ERROR; |
| ULayoutType layout_dir = uloc_getCharacterOrientation(locale_name, &status); |
| DCHECK(U_SUCCESS(status)); |