diff --git a/config/alfresco/application-context.xml b/config/alfresco/application-context.xml index c39560b81e..973a3d6c10 100644 --- a/config/alfresco/application-context.xml +++ b/config/alfresco/application-context.xml @@ -36,7 +36,8 @@ - + + diff --git a/source/java/org/alfresco/repo/template/I18NMessageMethod.java b/source/java/org/alfresco/repo/template/I18NMessageMethod.java index 42fadefd49..649983c08b 100644 --- a/source/java/org/alfresco/repo/template/I18NMessageMethod.java +++ b/source/java/org/alfresco/repo/template/I18NMessageMethod.java @@ -49,15 +49,41 @@ public class I18NMessageMethod extends BaseTemplateProcessorExtension implements public Object exec(List args) throws TemplateModelException { String result = ""; - - if (args.size() == 1) + int argSize = args.size(); + + if (argSize > 0) { - Object arg0 = args.get(0); - if (arg0 instanceof TemplateScalarModel) - { - String id = ((TemplateScalarModel)arg0).getAsString(); + String id = ""; + Object arg0 = args.get(0); + if (arg0 instanceof TemplateScalarModel) + { + id = ((TemplateScalarModel)arg0).getAsString(); + } + + if (argSize == 1) + { + // Shortcut for no additional params result = I18NUtil.getMessage(id); - } + } + else + { + Object arg; + Object[] params = new Object[argSize - 1]; + for (int i = 0; i < argSize-1; i++) + { + // Note: need to ignore first passed-in arg + arg = args.get(i+1); + if (arg instanceof TemplateScalarModel) + { + params[i] = ((TemplateScalarModel)arg).getAsString(); + } + else + { + params[i] = new String(""); + } + } + result = I18NUtil.getMessage(id, params); + } } return result;