Mapping/Routing: connecting ?lang=de to blah.org/de?

Hi List,

how would you modify routes.rb to get something like

http://example.org/de/controller/action

instead of

http://example.org/controller/action/?lang=de

?

(Using the Ruby-GetText method for internationalization,
which allows you to specify the sites’ language in the
lang param)

I’d be grateful for any hints that you might have!

Regards,
Raphael

Raphael S. wrote:

Hi List,

how would you modify routes.rb to get something like

http://example.org/de/controller/action

instead of

http://example.org/controller/action/?lang=de

?

(Using the Ruby-GetText method for internationalization,
which allows you to specify the sites’ language in the
lang param)

I’d be grateful for any hints that you might have!

Regards,
Raphael

Okay, as usual, here’s the solution for fellow journeymen
(thanks a heap to Geffy!)

map.connect “:lang/:controller/:action/:id”, :defaults => { :lang =>
‘de’ }

I’m not sure about the international part of your url, but I would
assume you would change this just I many have changed the paginated
urls. Here is a blog posting of mine that details how to change the
paginated urls to work just as you are asking.

http://www.recentrambles.com/pragmatic/view/45

Charlie B.
www.recentrambles.com