Reputation: 831
I've tried to set it in Bootstrap but it don't work Also tried in ../conf/spring/resources.groovy .. it don't work either.
In Bootstrap i tried with:
Locale defLocale = new Locale("en", "GB");
Locale.setDefault(defLocale);
And in resources.groovy I tried this:
import org.springframework.web.servlet.i18n.SessionLocaleResolver
beans = {
localeResolver(SessionLocaleResolver) {
defaultLocale= new java.util.Locale("en","GB")
}
}
and a lot of variants I found when googling. I'm sure it must be a way but it seems very hard to find.
Upvotes: 0
Views: 451
Reputation: 39907
Try this,
String springLocaleAtt = 'org.springframework.web.servlet.i18n.SessionLocaleResolver.LOCALE'
session[springLocaleAtt] = new Locale('en_GB')
Upvotes: 0
Reputation: 351
When you create a session(for example when logging in), you can do the following:
if(setDefaultLanguage) {
session['org.springframework.web.servlet.i18n.' +
'SessionLocaleResolver.LOCALE'] = 'en-GB'
}
Upvotes: 1