/** * Returns a formatted {@link String} of the given key for current {@link Locale}. * * <p> * Returns <code>null</code> if the given key not exists for current {@link Locale}. * * @see MessageSource#tryGetMessage(Locale, String, Object...) */ public static String tryGetMessage(String key,Object... args) { RequestContext current = current(); return current.getMessageSource().tryGetMessage(current.getLocale(),key, args); }
/** * Returns a formatted {@link String} of the given key and current locale. * * @throws ObjectNotFoundException if the given key not exists. * * @see MessageSource#getMessage(String, Object...) */ public static String getMessage(String key,Object... args) throws ObjectNotFoundException { RequestContext current = current(); return current.getMessageSource().getMessage(current.getLocale(),key, args); }