コード例 #1
0
ファイル: MessagesUtil.java プロジェクト: norain2050/gl_shop
 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);
 }
コード例 #2
0
 /*
  * (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
ファイル: ViewSupport.java プロジェクト: gitter-badger/jdal
 /**
  * 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());
 }