Set locale_default at initial admin creation too.

This commit is contained in:
Martin Edenhofer 2017-12-06 15:31:27 +01:00
parent fd8511e44c
commit 6c0f7fc1e7
3 changed files with 33 additions and 21 deletions

View file

@ -240,6 +240,9 @@ class Admin extends App.WizardFullScreen
relogin: (data, status, xhr) =>
@log 'notice', 'relogin:success', data
callback = ->
App.Setting.set('locale_default', App.i18n.detectBrowserLocale())
App.Setting.fetchFull(callback)
App.Event.trigger 'notify:removeall'
@navigate 'getting_started/base'

View file

@ -1,13 +1,20 @@
class SettingDefaultLocale < ActiveRecord::Migration[5.1]
class SettingDefaultLocale2 < ActiveRecord::Migration[5.1]
def up
# return if it's a new setup
return if !Setting.find_by(name: 'system_init_done')
setting = Setting.find_by(name: 'locale_default')
if setting
setting.area = 'System::Branding'
setting.preferences[:prio] = 8
setting.save!
end
Setting.create_if_not_exists(
title: 'Locale',
name: 'locale_default',
area: 'System::Base',
area: 'System::Branding',
description: 'Defines the system default language.',
options: {
form: [
@ -18,6 +25,7 @@ class SettingDefaultLocale < ActiveRecord::Migration[5.1]
},
state: 'en-us',
preferences: {
prio: 8,
controller: 'SettingsAreaItemDefaultLocale',
permission: ['admin.system'],
},

View file

@ -156,6 +156,26 @@ Setting.create_if_not_exists(
},
frontend: true
)
Setting.create_if_not_exists(
title: 'Locale',
name: 'locale_default',
area: 'System::Branding',
description: 'Defines the system default language.',
options: {
form: [
{
name: 'locale_default',
}
],
},
state: 'en-us',
preferences: {
prio: 8,
controller: 'SettingsAreaItemDefaultLocale',
permission: ['admin.system'],
},
frontend: true
)
Setting.create_or_update(
title: 'Pretty Date',
name: 'pretty_date_format',
@ -183,25 +203,6 @@ Setting.create_or_update(
state: 'relative',
frontend: true
)
Setting.create_if_not_exists(
title: 'Locale',
name: 'locale_default',
area: 'System::Base',
description: 'Defines the system default language.',
options: {
form: [
{
name: 'locale_default',
}
],
},
state: 'en-us',
preferences: {
controller: 'SettingsAreaItemDefaultLocale',
permission: ['admin.system'],
},
frontend: true
)
options = {}
(10..99).each do |item|
options[item] = item