Class: Maglev::ChangeSiteLocales

Inherits:
Object
  • Object
show all
Includes:
Injectable
Defined in:
app/services/maglev/change_site_locales.rb

Overview

Change the locales of a site. The new locales are an array of Maglev::Site::Locale objects

Instance Method Summary collapse

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
20
# File 'app/services/maglev/change_site_locales.rb', line 12

def call
  return if locales.blank?

  if default_locale_changed? && !all_paths_translated?
    raise 'The translations for the new default locale are incomplete'
  end

  site.update(locales: locales)
end