/** {@inheritDoc} */ public MessageResolution resolveMessage(Arguments args, String key, Object[] msgParams) { final Locale locale = args.getContext().getLocale(); String targetMsg = resolveProperties(locale).getProperty(key); if (targetMsg == null) { targetMsg = key; } else if (msgParams != null && msgParams.length > 0) { targetMsg = new MessageFormat(targetMsg, args.getContext().getLocale()).format(msgParams); } return new MessageResolution(targetMsg); }
return messageResolution.getResolvedMessage();
/** {@inheritDoc} */ public MessageResolution resolveMessage(Arguments args, String key, Object[] msgParams) { final Locale locale = args.getContext().getLocale(); String targetMsg = resolveProperties(locale).getProperty(key); if (targetMsg == null) { targetMsg = "<span style=\"color:red\">" + key + " not found</span>"; } else if (msgParams != null && msgParams.length > 0) { targetMsg = new MessageFormat(targetMsg, args.getContext().getLocale()).format(msgParams); } return new MessageResolution(targetMsg); }
public MessageResolution resolveMessage( final Arguments arguments, final String key, final Object[] messageParameters) { // This method can be overriden checkInitialized(); final String message = StandardMessageResolutionUtils.resolveMessageForTemplate( arguments, key, messageParameters, unsafeGetDefaultMessages()); if (message == null) { return null; } return new MessageResolution(message); }
/** * <p> * Resolve the message, returning a {@link MessageResolution} object. * </p> * <p> * If the message cannot be resolved, this method should return null. * </p> * * @param arguments the {@link Arguments} object being used for template processing * @param key the message key * @param messageParameters the (optional) message parameters * @return a {@link MessageResolution} object containing the resolved message, * {@literal null} is returned when the resolver cannot retrieve a message for the given key. This policy is * compliant with the (Thymeleaf) standard message resolver. */ @Override public MessageResolution resolveMessage(Arguments arguments, String key, Object[] messageParameters) { Locale[] locales = getLocales(); String message = i18n.get(locales, key, messageParameters); // Same policy as the Thymeleaf standard message resolver. if (message == null) { return null; } return new MessageResolution(message); }