# Need help with languages and http://mir.aculo.us/articles/20

**URL:** <https://www.ruby-forum.com/t/need-help-with-languages-and-http-mir-aculo-us-articles-20/48923>\
**Category:** Rails\
**Created:** [November 16, 2005, 9:52am UTC](https://www.ruby-forum.com/t/need-help-with-languages-and-http-mir-aculo-us-articles-20/48923 "2005-11-16T09:52:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brutyn\_nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@brutyn\_nick](https://www.ruby-forum.com/u/brutyn_nick)\
**Post date:** [November 16, 2005, 9:52am UTC](https://www.ruby-forum.com/t/need-help-with-languages-and-http-mir-aculo-us-articles-20/48923/1 "2005-11-16T09:52:58Z")

</div>

hey,  
i have tried to use this

but i was wondering how can the user switch between languages???

in my index.rthml

 TEST 
# dit is een test
\< =\_ (â??i amâ??) \>   
\< =\_ (â??dogâ??) \>   
\< =\_ (â??catâ??) \>   
\< =\_ (â??birdâ??) \>   

in my application.rhtml

 testing Hey, xcvcvcwxv  
\< = link\_to â??nederlandsâ?, :controller =\> â??testâ?, :action =\> â??nederlandsâ? \>  
\< = link\_to â??duitsâ?, :controller =\> â??testâ?, :action =\> â??duitsâ? \>  
\< = link\_to â??engelsâ?, :controller =\> â??testâ?, :action =\> â??engelsâ? \>  
\< = @content\_for\_layout \> 

and in controller.rb  
def nederlands  
Localization.lang = â??nl\_BEâ??  
redirect\_to :action =\> â??indexâ?  
end

def duits  
Localization.lang = ‘de\_DE’  
redirect\_to :action =\> “index”  
end

def engels  
Localization.lang = ‘en\_US’  
redirect\_to :action =\> “index”  
end

def index

end

this doesnt seem to work, or do i this wrong???

thanks in advance

---

<div class="post-metadata">

**Author:** ![brutyn\_nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@brutyn\_nick](https://www.ruby-forum.com/u/brutyn_nick)\
**Post date:** [November 16, 2005, 12:27pm UTC](https://www.ruby-forum.com/t/need-help-with-languages-and-http-mir-aculo-us-articles-20/48923/2 "2005-11-16T12:27:01Z")

</div>

On 16-nov-2005, at 9:46, Brutyn N. wrote:

> \< =\_ (?dog?) \>   
>   
> ?nederlands? \>  
>   
> end
> 
> def index
> 
> end
> 
> this doesnt seem to work, or do i this wrong???

Of course it doesn’t - you have to define your Localization.lang  
(wherever Localization comes from) on every request,  
for example in a pre\_filter. Here you do a “redirect” in which your  
language does not get set.

–  
Julian “Julik” Tarkhanov

---

<div class="post-metadata">

**Author:** ![brutyn\_nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@brutyn\_nick](https://www.ruby-forum.com/u/brutyn_nick)\
**Post date:** [November 16, 2005, 5:05pm UTC](https://www.ruby-forum.com/t/need-help-with-languages-and-http-mir-aculo-us-articles-20/48923/3 "2005-11-16T17:05:40Z")

</div>

On 16-nov-2005, at 12:51, Brutyn N. wrote:

> Localization.lang = ?nl\_BE?

What I meant is that you have to configure the language for every  
request BEFORE the action gets called.

When you do

def engels  
Localization.lang = ‘en\_US’  
redirect\_to :action =\> “index”  
end

the stuff you send to Localization is going to take effect for this  
action, but not for the one you are redirecting to.

–  
Julian “Julik” Tarkhanov

---

<div class="post-metadata">

**Author:** ![brutyn\_nick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e79b87/32.png) [@brutyn\_nick](https://www.ruby-forum.com/u/brutyn_nick)\
**Post date:** [November 16, 2005, 12:57pm UTC](https://www.ruby-forum.com/t/need-help-with-languages-and-http-mir-aculo-us-articles-20/48923/4 "2005-11-16T12:57:14Z")

</div>

> Of course it doesn’t - you have to define your Localization.lang  
> (wherever Localization comes from) on every request,  
> for example in a pre\_filter. Here you do a “redirect” in which your  
> language does not get set.

in my application.rb i do

Localization.lang = â??nl\_BEâ??
