FEATURE: Add a onebox_locale site setting. (#30655)

Following on from f369db5ae9, this change adds the ability to choose a custom locale to send to onebox providers.

If this setting is left blank, it will fall back to using default_locale.
This commit is contained in:
Gary Pendergast
2025-01-09 14:11:37 +11:00
committed by GitHub
parent 590b3e11fb
commit f53c734ba6
7 changed files with 66 additions and 17 deletions

View File

@@ -0,0 +1,11 @@
# frozen_string_literal: true
# onebox_locale is just like any other locale setting, except it allows for an empty value,
# which is used to indicate that the default_locale should be used for onebox_locale.
class OneboxLocaleSiteSetting < LocaleSiteSetting
def self.valid_value?(val)
supported_locales.include?(val) || val == ""
end
@lock = Mutex.new
end