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:
@@ -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!
|
||||
|
||||
@@ -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!
|
||||
|
||||
Reference in New Issue
Block a user