예제 #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());
   }
 }
예제 #2
0
파일: JFinal.java 프로젝트: jerryou/goja
 private void initI18n() {
   String i18nResourceBaseName = constants.getI18nResourceBaseName();
   if (i18nResourceBaseName != null) {
     I18N.init(
         i18nResourceBaseName,
         constants.getI18nDefaultLocale(),
         constants.getI18nMaxAgeOfCookie());
   }
 }
예제 #3
0
 public String getText(String key) {
   return I18N.getText(key, getLocaleFromCookie());
 }
예제 #4
0
 public String getText(String key, String defaultValue) {
   return I18N.getText(key, defaultValue, getLocaleFromCookie());
 }
예제 #5
0
 /** Write Local to cookie */
 public Controller setLocaleToCookie(Locale locale) {
   setCookie(I18N_LOCALE, locale.toString(), I18N.getI18nMaxAgeOfCookie());
   return this;
 }