Class: Pwb::LocaleLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/pwb/locale_loader.rb

Class Method Summary collapse

Class Method Details

.load_locale!(from_locale, to_locale) ⇒ Object

Call from console: require ‘pwb/locale_loader’ or load “#Engine.root/lib/pwb/locale_loader.rb” Pwb::LocaleLoader.load_locale! “en”, “es”



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/pwb/locale_loader.rb', line 10

def load_locale!(from_locale, to_locale)
  # Will go through each property and populate
  # the title and description for one locale
  # from the other
  Pwb::Prop.all.each do |prop|
    col_prefixes = ["title_", "description_"]
    update_single_record prop, col_prefixes, from_locale, to_locale
  end
  Pwb::Content.all.each do |content|
    col_prefixes = ["raw_"]
    update_single_record content, col_prefixes, from_locale, to_locale
  end
end