20171206000001_setting_default_locale2.rb 824 B

123456789101112131415161718192021222324252627282930313233343536
  1. class SettingDefaultLocale2 < ActiveRecord::Migration[5.1]
  2. def up
  3. # return if it's a new setup
  4. return if !Setting.find_by(name: 'system_init_done')
  5. setting = Setting.find_by(name: 'locale_default')
  6. if setting
  7. setting.area = 'System::Branding'
  8. setting.preferences[:prio] = 8
  9. setting.save!
  10. end
  11. Setting.create_if_not_exists(
  12. title: 'Locale',
  13. name: 'locale_default',
  14. area: 'System::Branding',
  15. description: 'Defines the system default language.',
  16. options: {
  17. form: [
  18. {
  19. name: 'locale_default',
  20. }
  21. ],
  22. },
  23. state: 'en-us',
  24. preferences: {
  25. prio: 8,
  26. controller: 'SettingsAreaItemDefaultLocale',
  27. permission: ['admin.system'],
  28. },
  29. frontend: true
  30. )
  31. end
  32. end