Forum: Ruby on Rails Mapping/Routing: connecting ?lang=de to blah.org/de?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Raphael S. (Guest)
on 2006-05-03 00:35
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. (Guest)
on 2006-05-03 00:52
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' }
Charlie B. (Guest)
on 2006-05-03 21:02
(Received via mailing list)
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
This topic is locked and can not be replied to.