Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

seeds multiple language localization fix #314

Closed
wants to merge 1 commit into from

4 participants

@sunbeta

No description provided.

@ugisozols ugisozols commented on the diff
db/seeds.rb
((3 lines not shown))
- user.plugins.create(:name => "refinerycms_blog",
- :position => (user.plugins.maximum(:position) || -1) +1)
- end
-end if defined?(Refinery::User)
-
-if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => '/blog')
- page = Refinery::Page.create(
- :title => "Blog",
- :link_url => "/blog",
- :deletable => false,
- :menu_match => "^/blogs?(\/|\/.+?|)$"
- )
-
- Refinery::Pages.default_parts.each do |default_page_part|
- page.parts.create(:title => default_page_part, :body => nil)
+(Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
@ugisozols Owner

In 2.1.x Refinery::I18n is a dependency of core so you don't need to check if i18n_enabled? anymore. You can simplify that line to:

Refinery::I18n.frontend_locales.each do |lang|
@parndt Owner
parndt added a note

This fails CI because Refinery doesn't know about i18n_enabled? anymore so the fix proposed by @ugisozols seems best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@keram keram commented on the diff
db/seeds.rb
((23 lines not shown))
+ user.plugins.create(:name => "refinerycms_blog",
+ :position => (user.plugins.maximum(:position) || -1) +1)
+ end
+ end if defined?(Refinery::User)
+
+ if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => '/blog')
+ page = Refinery::Page.create(
+ :title => "Blog",
+ :link_url => "/blog",
+ :deletable => false,
+ :menu_match => "^/blogs?(\/|\/.+?|)$"
+ )
+
+ Refinery::Pages.default_parts.each do |default_page_part|
+ page.parts.create(:title => default_page_part, :body => nil)
+ end
@keram
keram added a note

and here should come:
I18n.locale = I18n.default_locale
because we want clean up after us, don't we? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@ugisozols
Owner

@sunbeta are you keen to fix this PR or should we close it?

@parndt
Owner

Any interest in this?

@ugisozols
Owner

Closing due to inactivity.

@ugisozols ugisozols closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 14, 2013
  1. @sunbeta
This page is out of date. Refresh to see the latest.
Showing with 21 additions and 17 deletions.
  1. +21 −17 db/seeds.rb
View
38 db/seeds.rb
@@ -1,19 +1,23 @@
-Refinery::User.all.each do |user|
- if user.plugins.where(:name => 'refinerycms_blog').blank?
- user.plugins.create(:name => "refinerycms_blog",
- :position => (user.plugins.maximum(:position) || -1) +1)
- end
-end if defined?(Refinery::User)
-
-if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => '/blog')
- page = Refinery::Page.create(
- :title => "Blog",
- :link_url => "/blog",
- :deletable => false,
- :menu_match => "^/blogs?(\/|\/.+?|)$"
- )
-
- Refinery::Pages.default_parts.each do |default_page_part|
- page.parts.create(:title => default_page_part, :body => nil)
+(Refinery.i18n_enabled? ? Refinery::I18n.frontend_locales : [:en]).each do |lang|
@ugisozols Owner

In 2.1.x Refinery::I18n is a dependency of core so you don't need to check if i18n_enabled? anymore. You can simplify that line to:

Refinery::I18n.frontend_locales.each do |lang|
@parndt Owner
parndt added a note

This fails CI because Refinery doesn't know about i18n_enabled? anymore so the fix proposed by @ugisozols seems best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ I18n.locale = lang
+
+ Refinery::User.all.each do |user|
+ if user.plugins.where(:name => 'refinerycms_blog').blank?
+ user.plugins.create(:name => "refinerycms_blog",
+ :position => (user.plugins.maximum(:position) || -1) +1)
+ end
+ end if defined?(Refinery::User)
+
+ if defined?(Refinery::Page) and !Refinery::Page.exists?(:link_url => '/blog')
+ page = Refinery::Page.create(
+ :title => "Blog",
+ :link_url => "/blog",
+ :deletable => false,
+ :menu_match => "^/blogs?(\/|\/.+?|)$"
+ )
+
+ Refinery::Pages.default_parts.each do |default_page_part|
+ page.parts.create(:title => default_page_part, :body => nil)
+ end
@keram
keram added a note

and here should come:
I18n.locale = I18n.default_locale
because we want clean up after us, don't we? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
end
end
Something went wrong with that request. Please try again.