20171206000001_setting_default_locale2.rb 940 B

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