mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-14 19:41:29 +08:00
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.
17 lines
436 B
Ruby
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
|