From 4ff9b82be978e0f3033345b76b5a954aaad29a10 Mon Sep 17 00:00:00 2001 From: Mike Hatfield Date: Mon, 3 Dec 2007 21:27:46 +0000 Subject: [PATCH] Office add-in collaboration updates git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@7512 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- config/alfresco/application-context.xml | 3 +- .../repo/template/I18NMessageMethod.java | 40 +++++++++++++++---- 2 files changed, 35 insertions(+), 8 deletions(-) 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;