Index: base/i18n/rtl.cc |
diff --git a/base/i18n/rtl.cc b/base/i18n/rtl.cc |
index 96ef9aaecd257b16b9e8054e90c5421776a5e8c8..e8bec4cafd5b7f1c1a6623236f4106dccba8be15 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,27 @@ 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) { |
+ static const char* kRTLLocales[] = { |
jungshik at Google
2015/08/11 19:23:13
Please, add a note that this list has to be update
danduong
2015/08/11 20:01:10
Done.
|
+ "ar", |
+ "fa", |
+ "he", |
+ "iw", |
jungshik at Google
2015/08/11 19:23:13
'iw' is a legacy name for 'he' and this API should
danduong
2015/08/11 20:01:10
Acknowledged. I'd rather leave this here to be def
|
+ "ur" |
+ }; |
+ for (const char* rtl_locale : kRTLLocales) { |
+ if (StartsWith(locale_name, rtl_locale, CompareCase::SENSITIVE)) |
+ 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)); |