Merge "screen_ui: Fix an issue in RTL locale detection." am: 13d56e9bed am: 0e42c5680c
am: a8c819d98c

Change-Id: Ic7b0d44650e686a5fcd68fe9cb4e0e10b0f13772
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 4ea458f..fd7a1be 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -1101,9 +1101,9 @@
   rtl_locale_ = false;
 
   if (!new_locale.empty()) {
-    size_t underscore = new_locale.find('_');
-    // lang has the language prefix prior to '_', or full string if '_' doesn't exist.
-    std::string lang = new_locale.substr(0, underscore);
+    size_t separator = new_locale.find('-');
+    // lang has the language prefix prior to the separator, or full string if none exists.
+    std::string lang = new_locale.substr(0, separator);
 
     // A bit cheesy: keep an explicit list of supported RTL languages.
     if (lang == "ar" ||  // Arabic
diff --git a/tests/unit/screen_ui_test.cpp b/tests/unit/screen_ui_test.cpp
index ff8a35d..03e23ca 100644
--- a/tests/unit/screen_ui_test.cpp
+++ b/tests/unit/screen_ui_test.cpp
@@ -255,7 +255,7 @@
  protected:
   const std::string kTestLocale = "en-US";
   const std::string kTestRtlLocale = "ar";
-  const std::string kTestRtlLocaleWithSuffix = "ar_EG";
+  const std::string kTestRtlLocaleWithSuffix = "ar-EG";
 
   void SetUp() override {
     ui_ = std::make_unique<TestableScreenRecoveryUI>();