Merge "screen_ui: Fix an issue in RTL locale detection."
This commit is contained in:
+3
-3
@@ -1101,9 +1101,9 @@ void ScreenRecoveryUI::SetLocale(const std::string& new_locale) {
|
|||||||
rtl_locale_ = false;
|
rtl_locale_ = false;
|
||||||
|
|
||||||
if (!new_locale.empty()) {
|
if (!new_locale.empty()) {
|
||||||
size_t underscore = new_locale.find('_');
|
size_t separator = new_locale.find('-');
|
||||||
// lang has the language prefix prior to '_', or full string if '_' doesn't exist.
|
// lang has the language prefix prior to the separator, or full string if none exists.
|
||||||
std::string lang = new_locale.substr(0, underscore);
|
std::string lang = new_locale.substr(0, separator);
|
||||||
|
|
||||||
// A bit cheesy: keep an explicit list of supported RTL languages.
|
// A bit cheesy: keep an explicit list of supported RTL languages.
|
||||||
if (lang == "ar" || // Arabic
|
if (lang == "ar" || // Arabic
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ class ScreenRecoveryUITest : public ::testing::Test {
|
|||||||
protected:
|
protected:
|
||||||
const std::string kTestLocale = "en-US";
|
const std::string kTestLocale = "en-US";
|
||||||
const std::string kTestRtlLocale = "ar";
|
const std::string kTestRtlLocale = "ar";
|
||||||
const std::string kTestRtlLocaleWithSuffix = "ar_EG";
|
const std::string kTestRtlLocaleWithSuffix = "ar-EG";
|
||||||
|
|
||||||
void SetUp() override {
|
void SetUp() override {
|
||||||
ui_ = std::make_unique<TestableScreenRecoveryUI>();
|
ui_ = std::make_unique<TestableScreenRecoveryUI>();
|
||||||
|
|||||||
Reference in New Issue
Block a user