Brutyn Nick
2005-Nov-16 08:46 UTC
need help with languages and http://mir.aculo.us/articles/2005/10/03/ruby-on-rails-i18n-revisited
hey, i have tried to use this but i was wondering how can the user switch between languages??? in my index.rthml <html> <head> <title>TEST</title> </head> <body> <h1>dit is een test</h1> < =_ (‘i am’) > <br/> < =_ (‘dog’) > <br/> < =_ (‘cat’) > <br/> < =_ (‘bird’) > <br/> </body> </html> in my application.rhtml <html> <head> <title>testing</title> </head> <body> Hey, xcvcvcwxv<br/> < = link_to “nederlands”, :controller => “test”, :action => “nederlands” ><br/> < = link_to “duits”, :controller => “test”, :action => “duits” ><br/> < = link_to “engels”, :controller => “test”, :action => “engels” ><br/> < = @content_for_layout > </body> </html> 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
Julian ''Julik'' Tarkhanov
2005-Nov-16 11:24 UTC
Re: need help with languages and http://mir.aculo.us/articles/2005/10/03/ruby-on-rails-i18n-revisited
On 16-nov-2005, at 9:46, Brutyn Nick wrote:> hey, > i have tried to use this > > but i was wondering how can the user switch between languages??? > > in my index.rthml > <html> <head> <title>TEST</title> </head> > <body> > <h1>dit is een test</h1> > < =_ (‘i am’) > <br/> > < =_ (‘dog’) > <br/> > < =_ (‘cat’) > <br/> > < =_ (‘bird’) > <br/> > </body> > </html> > > in my application.rhtml > <html> <head> <title>testing</title> </head> > <body> > Hey, xcvcvcwxv<br/> > < = link_to “nederlands”, :controller => “test”, :action => > “nederlands” ><br/> > < = link_to “duits”, :controller => “test”, :action => “duits” ><br/> > < = link_to “engels”, :controller => “test”, :action => “engels” > ><br/> > < = @content_for_layout > > </body> </html> > > 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???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
Brutyn Nick
2005-Nov-16 11:51 UTC
Re: need help with languages and http://mir.aculo.us/articles/2005/10/03/ruby-on-rails-i18n-revisited
> 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’
Julian ''Julik'' Tarkhanov
2005-Nov-16 16:04 UTC
Re: Re: need help with languages and http://mir.aculo.us/articles/2005/10/03/ruby-on-rails-i18n-revisited
On 16-nov-2005, at 12:51, Brutyn Nick wrote:> >> 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’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