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


#1

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


#2

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


#3

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


#4

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â??