Wednesday, December 11, 2013

Change i18n locale from a controller before calling the view


package pritom.com.locale;

import org.springframework.web.servlet.support.RequestContextUtils as RCU

class FormController {
    def test() {
        Locale locale = new Locale("fr");
        RCU.getLocaleResolver(request).setLocale(request, response, locale);
        render g.message(code: "default.paginate.prev");
    }
}

No comments:

Post a Comment