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

**URL:** <https://www.ruby-forum.com/t/mapping-routing-connecting-lang-de-to-blah-org-de/94373>\
**Category:** Rails\
**Created:** [May 2, 2006, 10:35pm UTC](https://www.ruby-forum.com/t/mapping-routing-connecting-lang-de-to-blah-org-de/94373 "2006-05-02T22:35:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rapha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8dc957/32.png) [@rapha](https://www.ruby-forum.com/u/rapha)\
**Post date:** [May 2, 2006, 10:35pm UTC](https://www.ruby-forum.com/t/mapping-routing-connecting-lang-de-to-blah-org-de/94373/1 "2006-05-02T22:35:39Z")

</div>

Hi List,

how would you modify routes.rb to get something like

[http://example.org/de/controller/action](http://example.org/de/controller/action)

instead of

[http://example.org/controller/action/?lang=de](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

---

<div class="post-metadata">

**Author:** ![rapha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8dc957/32.png) [@rapha](https://www.ruby-forum.com/u/rapha)\
**Post date:** [May 2, 2006, 10:52pm UTC](https://www.ruby-forum.com/t/mapping-routing-connecting-lang-de-to-blah-org-de/94373/2 "2006-05-02T22:52:25Z")

</div>

Raphael S. wrote:

> Hi List,
> 
> how would you modify routes.rb to get something like
> 
> [http://example.org/de/controller/action](http://example.org/de/controller/action)
> 
> instead of
> 
> [http://example.org/controller/action/?lang=de](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’ }

---

<div class="post-metadata">

**Author:** ![rapha](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/8dc957/32.png) [@rapha](https://www.ruby-forum.com/u/rapha)\
**Post date:** [May 3, 2006, 7:02pm UTC](https://www.ruby-forum.com/t/mapping-routing-connecting-lang-de-to-blah-org-de/94373/3 "2006-05-03T19:02:35Z")

</div>

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](http://www.recentrambles.com/pragmatic/view/45)

Charlie B.  
[www.recentrambles.com](http://www.recentrambles.com)
