예제 #1
0
 @Override
 protected MessageFormat resolveCode(String code, Locale locale, String defaultMessage) {
   CacheTagUtils.tag(Message.class);
   MessageBundleEntry entry = getEntry(code, defaultMessage);
   Message message = getMessage(entry, locale);
   if (message != null) {
     return message.getMessageFormat(escapeSingleQuotes);
   }
   return null;
 }
예제 #2
0
 @Override
 protected String resolveCodeWithoutArguments(String code, Locale locale, String defaultMessage) {
   CacheTagUtils.tag(Message.class);
   MessageBundleEntry entry = getEntry(code, defaultMessage);
   Message message = getMessage(entry, locale);
   if (message != null) {
     return message.getText();
   }
   return null;
 }
예제 #3
0
 @Override
 protected String getMessageFromParent(String code, Object[] args, Locale locale) {
   String s = super.getMessageFromParent(code, args, locale);
   if (s == null) {
     MessageBundleEntry entry = MessageBundleEntry.loadByBundleAndCode(bundle, code);
     Message message = entry.getDefaultMessage();
     if (message != null) {
       if (args != null) {
         MessageFormat messageFormat = message.getMessageFormat(escapeSingleQuotes);
         if (messageFormat != null) {
           synchronized (messageFormat) {
             return messageFormat.format(args);
           }
         }
       } else {
         return message.getText();
       }
     }
   }
   return s;
 }
예제 #4
0
 public CommandResult execute(CommandContext context) {
   Message message = (Message) context.getBean();
   Site site = (Site) context.getParent();
   message.getEntry().addTranslation(site.getLocale());
   return new RefreshSiblingsResult(context);
 }
예제 #5
0
 @Override
 public boolean isEnabled(CommandContext context) {
   Message message = (Message) context.getBean();
   return MessageBundleEntry.C_LOCALE.equals(message.getLocale());
 }