I'm trying to render a GSP in a specific locale.
Both these solutions work
using params
/book/list?lang=es
Using code in controller
def newLocale = new Locale(lang)
RCU.getLocaleResolver(request).setLocale(request, response, newLocale)
render(view: "mail", model: [invoiceInstance: invoiceInstance])
Unfortunately both these solution change the session object forever and affects all GSP afterwards.
If I try the change the LocaleResolver after the Render statement it does not work.
// Switch to OWNER language for print preview
def newLocale = new Locale(lang)
RCU.getLocaleResolver(request).setLocale(request, response, newLocale)
render(view: "mail", model: [invoiceInstance: invoiceInstance])
// switch back to user language
def newLocale2 = new Locale(user.language)
RCU.getLocaleResolver(request).setLocale(request, response, newLocale2)
So how can a force a SINGLE render in a specific locale?
After much search I had to pass the locale object to every tags in the GSP.
Not elegant for Grails but it works.