Use standard locale names for Globalize

It turns out it is not necessary to downcase and underscore
locale names to use the globalize-accessor gem. The gem
will automatically underscore the locale name when defining and
calling the accessor methods.
This commit is contained in:
Marko Lovic
2018-08-24 12:01:47 +02:00
committed by Javi Martín
parent 6fe7dc22bc
commit c7fcdd9b0e
10 changed files with 21 additions and 26 deletions

View File

@@ -10,8 +10,7 @@ section "Creating banners" do
post_ended_at: rand((Time.current - 1.day)..(Time.current + 1.week)),
created_at: rand((Time.current - 1.week)..Time.current))
I18n.available_locales.map do |locale|
neutral_locale = locale.to_s.downcase.underscore.to_sym
Globalize.with_locale(neutral_locale) do
Globalize.with_locale(locale) do
banner.description = "Description for locale #{locale}"
banner.title = "Title for locale #{locale}"
banner.save!

View File

@@ -143,8 +143,7 @@ section "Creating investment milestones" do
Budget::Investment.all.each do |investment|
milestone = Budget::Investment::Milestone.new(investment_id: investment.id, publication_date: Date.tomorrow)
I18n.available_locales.map do |locale|
neutral_locale = locale.to_s.downcase.underscore.to_sym
Globalize.with_locale(neutral_locale) do
Globalize.with_locale(locale) do
milestone.description = "Description for locale #{locale}"
milestone.title = I18n.l(Time.current, format: :datetime)
milestone.save!