mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
FEATURE: Add a onebox_locale site setting. (#30655)
Following on from f369db5ae9a29a23299dff5f14768167230b0b79, 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:
17
spec/models/onebox_locale_site_setting_spec.rb
Normal file
17
spec/models/onebox_locale_site_setting_spec.rb
Normal file
@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.describe OneboxLocaleSiteSetting do
|
||||
describe ".valid_value?" do
|
||||
it "returns true for a locale that we have translations for" do
|
||||
expect(OneboxLocaleSiteSetting.valid_value?("en")).to eq(true)
|
||||
end
|
||||
|
||||
it "returns true for an empty value" do
|
||||
expect(OneboxLocaleSiteSetting.valid_value?("")).to eq(true)
|
||||
end
|
||||
|
||||
it "returns false for a locale that we do not have translations for" do
|
||||
expect(OneboxLocaleSiteSetting.valid_value?("swedish-chef")).to eq(false)
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user