A platform for community discussion. Free, open, simple.
FIX: Don't show empty switcher (#36407)
Natalie Tay0538dba91b82
diff --git a/frontend/discourse/app/components/header/icons.gjs b/frontend/discourse/app/components/header/icons.gjsindex bef811aada9..b6fbb73b218 100644--- a/frontend/discourse/app/components/header/icons.gjs+++ b/frontend/discourse/app/components/header/icons.gjs@@ -78,6 +78,10 @@ export default class Icons extends Component {}get showLanguageSwitcher() {+ if (!this.siteSettings.content_localization_enabled) {+ return false;+ }+const has_locales =!!this.siteSettings.content_localization_supported_locales;switch (this.siteSettings.content_localization_language_switcher) {diff --git a/spec/system/content_localization_language_switcher_spec.rb b/spec/system/content_localization_language_switcher_spec.rbindex 47d0910a494..75bcef5ce0f 100644--- a/spec/system/content_localization_language_switcher_spec.rb+++ b/spec/system/content_localization_language_switcher_spec.rb@@ -41,10 +41,16 @@ describe "Content localization language switcher", type: :system do)end- it "only shows the language switcher based on what is in target languages" do+ it "only shows the language switcher based on enabled state and what is in target languages" do+ SiteSetting.content_localization_enabled = falseSiteSetting.content_localization_language_switcher = "anonymous"+visit("/")+ expect(page).to have_no_css(SWITCHER_SELECTOR)++ SiteSetting.content_localization_enabled = true+ page.refreshswitcher.expandexpect(switcher).to have_content("English (US)")expect(switcher).to have_content("Japanese (日本語)")