(Shameless self-promotion) You can also use my translate_routes plugin:
http://github.com/raul/translate_routes/
which not only adds a locale parameter and prefix:
http://localhost:3000/en/articles/1/comments/1
http://localhost:3000/es/articulos/1/comentarios/1
But also allows you to translate the static fragments of your routes,
improving your SEO performance. Your current xxxxx_path and xxxxx_url
helpers will be transparently converted to the current request''s
locale, so you just need to add a .yml translations file and one line
to your config/routes.rb.
Hope it helps!
--
Raul Murciano - Freelance Web Developer
http://raul.murciano.net
On Sat, Sep 19, 2009 at 1:51 PM, Denis Denis
<rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>
wrote:>
> Hi,
>
> What kind of edition can we do to add a language parameter in thoses
> routes:
>
> ActionController::Routing::Routes.draw do |map|
> map.resource :user_session
> map.resources :users
> map.resources :posts, :has_many => :comments
> end
>
> For example, if the current language is english,
> http://localhost:3000/posts
>
> should become:
> http://localhost:3000/en/posts
>
> And
> http://localhost:3000/posts/1/comments/1
>
> should become:
> http://localhost:3000/en/posts/1/comments/1
>
> If possible, this new parameter should not modify my current paths, such
> as posts_path.
>
> Thanks for any ideas!
>
> Denis
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>