summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-05-12 00:27:19 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-05-12 00:27:19 +0200
commitb8c632aa9a585f39392128e3cc4aa4a8b2322618 (patch)
treeae7c7fe329cc683f5c104cbc1c16bc0e331e8350
parentMerge "Move device.cpp into librecovery_ui." am: db6dc14bff am: fb8636f48f (diff)
parentMerge "screen_ui: Fix an issue in RTL locale detection." am: 13d56e9bed (diff)
downloadandroid_bootable_recovery-b8c632aa9a585f39392128e3cc4aa4a8b2322618.tar
android_bootable_recovery-b8c632aa9a585f39392128e3cc4aa4a8b2322618.tar.gz
android_bootable_recovery-b8c632aa9a585f39392128e3cc4aa4a8b2322618.tar.bz2
android_bootable_recovery-b8c632aa9a585f39392128e3cc4aa4a8b2322618.tar.lz
android_bootable_recovery-b8c632aa9a585f39392128e3cc4aa4a8b2322618.tar.xz
android_bootable_recovery-b8c632aa9a585f39392128e3cc4aa4a8b2322618.tar.zst
android_bootable_recovery-b8c632aa9a585f39392128e3cc4aa4a8b2322618.zip
-rw-r--r--screen_ui.cpp6
-rw-r--r--tests/unit/screen_ui_test.cpp2
2 files changed, 4 insertions, 4 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 4ea458f1d..fd7a1bea5 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -1101,9 +1101,9 @@ void ScreenRecoveryUI::SetLocale(const std::string& new_locale) {
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 ff8a35d6c..03e23ca42 100644
--- a/tests/unit/screen_ui_test.cpp
+++ b/tests/unit/screen_ui_test.cpp
@@ -255,7 +255,7 @@ class ScreenRecoveryUITest : public ::testing::Test {
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>();