Skip to content

Commit

Permalink
Merge pull request rhinstaller#453 from KKoukiou/rtl-en-us-switch
Browse files Browse the repository at this point in the history
localization: update the language direction also when switching back to EN_US
  • Loading branch information
KKoukiou authored Sep 30, 2024
2 parents 5aca39e + b3e6ec6 commit f280d18
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/localization/InstallationLanguage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,20 @@ class LanguageSelector extends React.Component {
cockpit.locale(null);
// en_US is always null
if (body.trim() === "") {
cockpit.locale(null);
cockpit.locale({
"": {
language: "en_US",
"language-direction": "ltr",
}
});
} else {
// eslint-disable-next-line no-eval
eval(body);

const langEvent = new CustomEvent("cockpit-lang");
window.dispatchEvent(langEvent);
}

const langEvent = new CustomEvent("cockpit-lang");
window.dispatchEvent(langEvent);

this.props.reRenderApp(item);
});
return;
Expand Down
6 changes: 6 additions & 0 deletions test/check-language
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ class TestLanguage(VirtInstallMachineCase):
l.check_selected_locale("he_IL")
b.wait_attr("html", "dir", "rtl")

# Expect language direction to be set to LTR when switching to EN_US from RTL language
# as this has special handling
l.select_locale("en_US")
l.check_selected_locale("en_US")
b.wait_attr("html", "dir", "ltr")

l.select_locale("de_DE")
l.check_selected_locale("de_DE")
b.wait_attr("html", "dir", "ltr")
Expand Down

0 comments on commit f280d18

Please sign in to comment.