public final static void applyMessages(Element target) {
String selector = SelectorUtil.tag(ExtNodeConstants.MSG_NODE_TAG);
List<Element> msgElems = target.select(selector);
for (Element msgElem : msgElems) {
Attributes attributes = msgElem.attributes();
if (!attributes.hasKey(ExtNodeConstants.MSG_NODE_ATTR_KEY)) {
InvalidMessageException ex = new InvalidMessageException(ExtNodeConstants.MSG_NODE_TAG + " tag must have key attribute.");
logger.error("", ex);
continue;
}
String key = attributes.get(ExtNodeConstants.MSG_NODE_ATTR_KEY);
List<String> externalizeParamKeys = getExternalizeParamKeys(attributes);
// TODO cache localed helper instance
ParamMapResourceBundleHelper helper = null;
if (attributes.hasKey(ExtNodeConstants.MSG_NODE_ATTR_LOCALE)) {
helper = new ParamMapResourceBundleHelper(LocalizeUtil.getLocale(attributes.get(ExtNodeConstants.MSG_NODE_ATTR_LOCALE)));
} else {
helper = new ParamMapResourceBundleHelper();
}
Map<String, Object> paramMap = getMessageParams(attributes, helper, key, externalizeParamKeys);