« Return to Thread: Change i18n locale from a controller before calling the view

Re: Change i18n locale from a controller before calling the view

by Simon Polak :: Rate this Message:

Reply to Author | View in Thread

Then the ip would resolve to the country proxy server is located in.

On Sat, Jul 4, 2009 at 8:14 PM, Finn Herpich <finn.herpich@...> wrote:
What about proxy-users? e.g. the tor-network?

Cheers

-----Original Message-----
From: AleCaste [mailto:alecaste@...]
Sent: Friday, July 03, 2009 2:49 PM
To: user@...
Subject: Re: [grails-user] Change i18n locale from a controller before calling the view


Hello guys,

I found the answer myself.
I want to post it here in case someone else has the same need in the future.
The controller code would look like this:


import org.springframework.web.servlet.support.RequestContextUtils as RCU
class myController {
 def index = {
   'Let's change the Locale to, let's say...  'es_ES'
   def newLocale = new Locale('es', 'ES')
   RCU.getLocaleResolver(request).setLocale(request, response, newLocale)
   'DONE! Now when the view is rendered, it'll be done using the new locale
 }
}
--
View this message in context: http://www.nabble.com/Change-i18n-locale-from-a-controller-before-calling-the-view-tp24321530p24322627.html
Sent from the grails - user mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email




Marfinn Software GmbH
Firmensitz: Endenicher Straße 262, 53121 Bonn
Registergericht: Amtsgericht Bonn, HRB 16233
Geschäftsführer: Martin Hensel, Finn Herpich


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Most of what we call management consists of making it difficult for people to get their work done.

 « Return to Thread: Change i18n locale from a controller before calling the view