Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could you please update the gem in rubygems #48

Open
acenqiu opened this issue Jun 26, 2013 · 6 comments
Open

Could you please update the gem in rubygems #48

acenqiu opened this issue Jun 26, 2013 · 6 comments

Comments

@acenqiu
Copy link

acenqiu commented Jun 26, 2013

The gem hosted in rubygems is still an old version, which is incompatible with Rails 4.

@lightbe
Copy link

lightbe commented Jul 20, 2013

Still has not been updated. I am having the same problem. I get the error below when I try to launch my Rails application.

cannot load such file -- routing_filter/adapters/rails_4

@kuroda
Copy link
Collaborator

kuroda commented Jul 20, 2013

I have published https://rubygems.org/gems/routing-filter/versions/0.4.0.pre. Please check if it works well.

@lightbe
Copy link

lightbe commented Aug 23, 2013

I have finally had a chance to use the 0.4.0.pre version of the gem for Rails 4. However I am finding differences between this version and the one I currently use in my Rails 3 applications. I'm not sure if there are differences in the routing-filter gems or if the issue is with i18n changes in Rails 4.

Here is the code I have in both applications in application_controller.rb where I set the locale and create a cookie.

before_filter :set_locale

private
def set_locale
I18n.locale = (params[:locale] if params[:locale].present?) || cookies[:locale] || 'en'
cookies[:locale] = I18n.locale if cookies[:locale] != I18n.locale.to_s
end

Here is the code I have in config/routes.rb.

filter :locale

When I run my Rails 3 applications the locale appears in the URL link and my debug info when I click all my links. When I run my Rails 4 application the only time the locale appears in the link is when I click a link to set the locale. When I click all my other links (text or icon) the translations appear correctly but there is not a locale value in the URL or in the debug info.

Here is the code for my locale line in my header.

<%= link_to_unless_current "English", locale: "en" %> <%= link_to_unless_current "Español", locale: "es" %> <%= link_to_unless_current "Français", locale: "fr" %>

Again I'm not sure if the issue is with the 0.4.0.pre gem or if I need to make additional i18n changes in my Rails 4 application. From reading the i18n documentation I'm not seeing anything additional I need to do. There is no specific documentation about 0.4.0.pre so I assume I should be able to do what I am doing with the Rails 3 version of routing-filter.

Any help would be appreciated.

@lightbe
Copy link

lightbe commented Oct 24, 2013

The routes still do not include the locale like the Rails 3 version did.

@Serabe
Copy link

Serabe commented Mar 5, 2014

Anything about this?

@lightbe
Copy link

lightbe commented Mar 5, 2014

I removed the gem since I could not get it working the way it did in Rails 3. The last I checked it is still a prerelease version. I am using the built in Rails 4 i18n functionality. I was able to get the routing I wanted with the locale in the route e.g. /en. I'm also have code where the locale defaults to en if it is missing from the route.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants