Forum: Ruby on Rails routing Translated Paths

Posted by Kad Kerforn (kadoudal)
on 2013-01-05 20:08
(Received via mailing list)
Happy new 2013 !  we're still on our nice blue planet !!

I am using translated path in my project, working fine

  scope '/:locale'  do
       ...
      scope(:path_names => { :new => I18n.t(:new, :scope => :paths), 
:edit
=> I18n.t(:edit, :scope => :paths) }) do
        resources :contacts, :only => [:new, :create], :path =>
I18n.t(:contacts, :scope => :paths)
        resources :portfolios, :only => [:show], :path =>
I18n.t(:portfolios, :scope => :paths)
        resources :craftworks, :only => [:index, :show], :path =>
I18n.t(:craftworks, :scope => :paths)
        resources :posts, :only => [:index, :show], :path => 
I18n.t(:posts,
:scope => :paths)
      end

starting the app with the default locale being :fr, I get all the routes
translated ... BUT
when a user switch the locale to :en, then the resources paths are
translated to english.. but not the path_names :
:new  and edit  are still in french .. what could be wrong  ?

thanks for feedback
Posted by Kad Kerforn (kadoudal)
on 2013-01-06 09:09
(Received via mailing list)
[SOLVED]  found the gem  rails-translate-routes ... so easy  !
https://github.com/francesc/rails-translate-routes

Le samedi 5 janvier 2013 20:07:30 UTC+1, Erwin a crit :
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.