discourse/lib/validators/language_switcher_setting_validator.rb
Natalie Tay ce6e8a9809
FEATURE: Show language switcher for anons (#32965)
Related: 
- https://github.com/discourse/discourse-translator/pull/308
- https://github.com/discourse/discourse/pull/32920 (setting introduced)

Moving the switcher to core, as the setting is now in core.
2025-05-29 11:37:20 +08:00

17 lines
436 B
Ruby

# frozen_string_literal: true
class LanguageSwitcherSettingValidator
def initialize(opts = {})
@opts = opts
end
def valid_value?(val)
return true if val == "f" || val == "false"
SiteSetting.set_locale_from_cookie &&
SiteSetting.experimental_content_localization_supported_locales.present?
end
def error_message
I18n.t("site_settings.errors.experimental_anon_language_switcher_requirements")
end
end