@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; }
@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; }
@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; }
public CommandResult execute(CommandContext context) { Message message = (Message) context.getBean(); Site site = (Site) context.getParent(); message.getEntry().addTranslation(site.getLocale()); return new RefreshSiblingsResult(context); }
@Override public boolean isEnabled(CommandContext context) { Message message = (Message) context.getBean(); return MessageBundleEntry.C_LOCALE.equals(message.getLocale()); }