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

Setting of the locale without URL params #723

Open
jhovad opened this issue May 18, 2017 · 2 comments
Open

Setting of the locale without URL params #723

jhovad opened this issue May 18, 2017 · 2 comments

Comments

@jhovad
Copy link

jhovad commented May 18, 2017

I would like the setting of the I18n.locale based on the domain. I have implemented it via before_filter in my ApplicationController. It means I don't need the :locale in URLs like example-en.com/en/products , example-fr.com/fr/products ... The reason why I don't want this is that it makes duplication of the URLs (example-en.com/products and example-en.com/en/products two URLs with the same content) which is bad for SEO. Can I somehow switch off the routing with :local parametr? THX in advance

@jhovad
Copy link
Author

jhovad commented May 19, 2017

edited:
Hi, I found I have to disable filter :locale in spree_i18n/config/routes.rb

I tried to disable it by adding this into my routes.rb,

  Rails.application.routes.draw do
    RoutingFilter.active = false
  end

but this solution breaks links in the app. Can you recommend me some better solution...? :-) Probably the best is overwrite somehow spree_i18n/config/routes.rb , but I don't know where I have to place my version of this file to be loaded as the preferred one.

@Dragsbaek
Copy link

@jhovad did you find a solution?

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

2 participants