2017-12-06 14:31:27 +00:00
|
|
|
class SettingDefaultLocale2 < ActiveRecord::Migration[5.1]
|
2017-11-15 14:06:53 +00:00
|
|
|
def up
|
|
|
|
|
|
|
|
# return if it's a new setup
|
|
|
|
return if !Setting.find_by(name: 'system_init_done')
|
|
|
|
|
2017-12-06 14:31:27 +00:00
|
|
|
setting = Setting.find_by(name: 'locale_default')
|
|
|
|
if setting
|
|
|
|
setting.area = 'System::Branding'
|
|
|
|
setting.preferences[:prio] = 8
|
|
|
|
setting.save!
|
|
|
|
end
|
|
|
|
|
2017-11-15 14:06:53 +00:00
|
|
|
Setting.create_if_not_exists(
|
|
|
|
title: 'Locale',
|
|
|
|
name: 'locale_default',
|
2017-12-06 14:31:27 +00:00
|
|
|
area: 'System::Branding',
|
2017-11-15 14:06:53 +00:00
|
|
|
description: 'Defines the system default language.',
|
|
|
|
options: {
|
|
|
|
form: [
|
|
|
|
{
|
|
|
|
name: 'locale_default',
|
|
|
|
}
|
|
|
|
],
|
|
|
|
},
|
|
|
|
state: 'en-us',
|
|
|
|
preferences: {
|
2017-12-06 14:31:27 +00:00
|
|
|
prio: 8,
|
2017-11-15 14:06:53 +00:00
|
|
|
controller: 'SettingsAreaItemDefaultLocale',
|
|
|
|
permission: ['admin.system'],
|
|
|
|
},
|
|
|
|
frontend: true
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|