/** * Utility method used to translate a code using the context translation * provider. If {@link #getMessageArgs(Map)} returns a not-null array or * arguments, they are passed to the translation provider to be used as message * format arguments. * * @param messageCode * the message code to translate. * @param context * the action context. * @return the translated message. */ protected String translate(String messageCode, Map<String, Object> context) { Object[] messageArgs = getMessageArgs(context); String translation; if (messageArgs == null) { translation = getTranslationProvider(context).getTranslation(messageCode, getLocale(context)); } else { translation = getTranslationProvider(context).getTranslation(messageCode, messageArgs, getLocale(context)); } return translation; }