Ejemplo n.º 1
0
 private Locale getLocaleFromCookie() {
   Cookie cookie = getCookieObject(I18N_LOCALE);
   if (cookie != null) {
     return I18N.localeFromString(cookie.getValue());
   } else {
     Locale defaultLocale = I18N.getDefaultLocale();
     setLocaleToCookie(defaultLocale);
     return I18N.localeFromString(defaultLocale.toString());
   }
 }
Ejemplo n.º 2
0
 private void initI18n() {
   String i18nResourceBaseName = constants.getI18nResourceBaseName();
   if (i18nResourceBaseName != null) {
     I18N.init(
         i18nResourceBaseName,
         constants.getI18nDefaultLocale(),
         constants.getI18nMaxAgeOfCookie());
   }
 }
Ejemplo n.º 3
0
 public String getText(String key) {
   return I18N.getText(key, getLocaleFromCookie());
 }
Ejemplo n.º 4
0
 public String getText(String key, String defaultValue) {
   return I18N.getText(key, defaultValue, getLocaleFromCookie());
 }
Ejemplo n.º 5
0
 /** Write Local to cookie */
 public Controller setLocaleToCookie(Locale locale) {
   setCookie(I18N_LOCALE, locale.toString(), I18N.getI18nMaxAgeOfCookie());
   return this;
 }