« Return to Thread: When exactly is the locale changed when using the lang parameter?

Re: When exactly is the locale changed when using the lang parameter?

by Graeme Rocher-2 :: Rate this Message:

Reply to Author | View in Thread

The lang switching relies on the Spring infrastructure and doesn't
read the Grails params object, but really it should. Please raise a
feature request in jIRA

Cheers

On Wed, May 14, 2008 at 10:08 PM, Jean-Noël Rivasseau <elvanor@...> wrote:

> Hello, on my web-application I would like to setup a custom URL
>  mapping that contains the locale to be used in the URL. Eg,
>  www.example.com/en/, www.example.com/fr for French, etc.
>
>  That way the URL contains the locale information which is nice for
>  bookmarking etc.
>
>  I made up the following URL mapping:
>
>           "/$lang?/about"
>                           {
>
>                   controller= "main"
>                   constraints
>                         {
>                                 lang(matches:/[a-z]{2}/)
>                         }
>                   action = "about"
>
>          }
>
>  Unfortunately, it is not working, the locale is not changed (on
>  www.example.com/fr/about/ ). If I manually specify the ?lang parameter
>  at the end of the URL it works though. This had led me to believe that
>  the "locale switching", based on the lang parameter, is maybe ran
>  before the URL mapping, or it does not use the lang parameter as set
>  by the URL mapping code in params.
>
>  How should I proceed then to achieve what I want? In a Filter maybe?
>
>  On a sidenote, the Grails guide says that forcing the locale via the
>  lang parameter sets up a cookie that remembers the choice. I sniffed
>  requests with Firebug and found no trace of such a cookie, so I guess
>  it is stored within the session? Can someone confirm?
>
>  As I will be essentially forcing the lang parameter every time with my
>  approach, I hope that the locale switching code is not heavy - does
>  someone know about this?
>
>  Thanks
>
>  Jean-Noel
>
>  ---------------------------------------------------------------------
>  To unsubscribe from this list, please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>
>



--
Graeme Rocher
Grails Project Lead
G2One, Inc. Chief Technology Officer
http://www.g2one.com

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

    http://xircles.codehaus.org/manage_email


 « Return to Thread: When exactly is the locale changed when using the lang parameter?

LightInTheBox - Buy quality products at wholesale price