예제 #1
0
 public static String getMessage(MessageSourceResolvable resolvable, Locale locale) {
   log.debug(
       "the locale is "
           + locale.getDisplayName()
           + " resolvable default message is "
           + resolvable.getDefaultMessage());
   return ms.getMessage(resolvable, locale);
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.hoteia.qalingo.core.i18n.message.CoreMessageSource#getMessage(org
  * .springframework.context.MessageSourceResolvable, java.util.Locale)
  */
 public String getMessage(final MessageSourceResolvable resolvable, final Locale locale)
     throws NoSuchMessageException {
   try {
     return messageSource.getMessage(resolvable, locale);
   } catch (Exception e) {
     logger.info(
         "This message key doesn't exist: "
             + resolvable.getCodes()
             + ", for this locale: "
             + locale.toString());
     if (BooleanUtils.negate(locale.toString().equalsIgnoreCase(Constants.DEFAULT_LOCALE_CODE))) {
       return getMessage(resolvable, new Locale(Constants.DEFAULT_LOCALE_CODE));
     }
   }
   return null;
 }
예제 #3
0
 /**
  * I18n Support
  *
  * @param msr message source resolvable
  * @return message or code if none defined
  */
 protected String getMessage(MessageSourceResolvable msr) {
   return messageSource == null
       ? msr.getDefaultMessage()
       : messageSource.getMessage(msr, LocaleContextHolder.getLocale());
 }