Translated (language-aware) routes in Rails application

Hi,

I’d like to have translated languate-aware routes in my application,
like:

/projects/5/permissions => locale “PL”
/projekty/5/pozwolenia => locale “PL”

Is there any way to achieve it with RESTful routes? I have done it
manually with named routes, but it’s overwhelming with over 300
routes :smiley: Also tried namespace (yeah, didn’t work) and Rails3 scope :frowning:

You may find useful my translate_routes plugin:

GitHub - raul/translate_routes: Rails plugin to translate your URLs and routing helpers on an clean way.


Raul M.
Freelance Web D. - http://raul.murciano.net
Ruby/Rails Trainer & Consultant - http://prorubyteam.com

Thanks Raul, this plugin is exactly what I wanted and looks really
promising - so I suppose there’s no particular way to do this without
any plugin?

So there’s no way to achieve this effect without plugin? Like scope or
namespace?

“PaweÅ‚ K” [email protected] wrote in message
news:[email protected]

So there’s no way to achieve this effect without plugin? Like scope or
namespace?

Not really. I mean, if manually work work for you, other than the number
of
lines, why don’t you use iteration?

ROUTE_TRANSLATION_SUPPORTED_LOCALES.each{ |loc|
map “/#{I18n.t(‘Projects’, :locale => loc)}” =>“Projects#index”

etc.

}

But if you want to be able to have the RESTful route helpers, and have
them
return translated routes, you will need a plugin.