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.
77961c972c437d6801714f45c3f2cc3c?d=identicon&s=25 Raphael Schmid (rapha)
on 2006-05-02 22: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
77961c972c437d6801714f45c3f2cc3c?d=identicon&s=25 Raphael Schmid (rapha)
on 2006-05-02 22:52
Raphael Schmid 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' }
89d967359903c639d31e4cad4569f537?d=identicon&s=25 Charlie Bowman (Guest)
on 2006-05-03 19: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 Bowman
www.recentrambles.com
This topic is locked and can not be replied to.