mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add support for enum site settings that render as a dropdown; use a dropdown for default_locale
This commit is contained in:
21
app/models/locale_site_setting.rb
Normal file
21
app/models/locale_site_setting.rb
Normal file
@@ -0,0 +1,21 @@
|
||||
class LocaleSiteSetting
|
||||
|
||||
def self.valid_value?(val)
|
||||
supported_locales.include?(val)
|
||||
end
|
||||
|
||||
def self.all_values
|
||||
supported_locales
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
|
||||
@lock = Mutex.new
|
||||
|
||||
def self.supported_locales
|
||||
@lock.synchronize do
|
||||
@supported_locales ||= Dir.glob( File.join(Rails.root, 'config', 'locales', 'client.*.yml') ).map {|x| x.split('.')[-2]}
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -203,7 +203,7 @@ class SiteSetting < ActiveRecord::Base
|
||||
setting(:title_fancy_entities, true)
|
||||
|
||||
# The default locale for the site
|
||||
setting(:default_locale, 'en')
|
||||
setting(:default_locale, 'en', enum: 'LocaleSiteSetting')
|
||||
|
||||
client_setting(:educate_until_posts, 2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user