- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 02 Sep 2009 10:40:47 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action In directory hutz:/tmp/cvs-serv27669/src/org/w3c/unicorn/action Modified Files: IndexAction.java ObserveAction.java Log Message: added language related messaged Index: IndexAction.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/IndexAction.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- IndexAction.java 1 Sep 2009 17:01:23 -0000 1.7 +++ IndexAction.java 2 Sep 2009 10:40:45 -0000 1.8 @@ -24,7 +24,6 @@ super.init(); } - @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -35,30 +34,38 @@ resp.setContentType("text/html; charset=UTF-8"); + ArrayList<Message> messages = new ArrayList<Message>(); + // Language negotiation String langParameter = req.getParameter(Property.get("UNICORN_PARAMETER_PREFIX") + "lang"); - if (langParameter == null || !Framework.getLanguageProperties().containsKey(langParameter)) + if (langParameter == null || !Framework.getLanguageProperties().containsKey(langParameter)) { langParameter = Language.negociate(req.getLocales()); + if (!langParameter.equals(req.getLocale().getLanguage())) { + messages.add(new Message(Message.Level.INFO, "$message_unavailable_language (" + req.getLocale().getDisplayLanguage(req.getLocale()) + "). $message_translation", null)); + } else { + String requested_parameter = req.getParameter(Property.get("UNICORN_PARAMETER_PREFIX") + "lang"); + if (requested_parameter != null && !Framework.getLanguageProperties().containsKey(requested_parameter)) + messages.add(new Message(Message.Level.INFO, "$message_unavailable_requested_language. $message_translation", null)); + } + } + + if (!Language.isComplete(langParameter)) + messages.add(new Message(Message.Level.INFO, "$message_incomplete_language. $message_translation", null)); velocityContext = new VelocityContext(Language.getContext(langParameter)); - ArrayList<Message> messages = new ArrayList<Message>(); - messages.add(new Message(Message.Level.WARNING, "un warning", null)); + + /*messages.add(new Message(Message.Level.WARNING, "un warning", null)); messages.add(new Message(Message.Level.ERROR, "une error", null)); messages.add(new Message(Message.Level.INFO, "une info", null)); messages.add(new Message(Message.Level.WARNING, "un warning avec long message", "le long message\nle long message\nle long message\nle long message\nle long message\nle long message\n")); messages.add(new Message(Message.Level.ERROR, "une error avec long message", "le long message\nle long message\nle long message\nle long message\nle long message\nle long message\n")); - messages.add(new Message(Message.Level.INFO, "une info avec long message", "le long message\nle long message\nle long message\nle long message\nle long message\nle long message\nle long message\n")); + messages.add(new Message(Message.Level.INFO, "une info avec long message", "le long message\nle long message\nle long message\nle long message\nle long message\nle long message\nle long message\n"));*/ + - if (!Language.isComplete(langParameter)) { - Message mess = new Message(Message.Level.INFO, "incomplete language", null); - messages.add(mess); - //velocityContext.put("message", mess); - } if (req.getAttribute("unicorn_message") != null) - //velocityContext.put("message", req.getAttribute("unicorn_message")); messages.add((Message) req.getAttribute("unicorn_message")); velocityContext.put("messages", messages); Index: ObserveAction.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/ObserveAction.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ObserveAction.java 1 Sep 2009 16:07:29 -0000 1.7 +++ ObserveAction.java 2 Sep 2009 10:40:45 -0000 1.8 @@ -131,7 +131,7 @@ if (aUnicornCall.getTask() == null) { aUnicornCall.setTask(Framework.mapOfTask.getDefaultTaskId()); - Message mess = new Message(Message.Level.WARNING, "No task specified! Unicorn used its default task: " + Framework.mapOfTask.get(Framework.mapOfTask.getDefaultTaskId()).getLongName("en"), null); + Message mess = new Message(Message.Level.WARNING, "$message_no_task " + Framework.mapOfTask.get(Framework.mapOfTask.getDefaultTaskId()).getLongName(langParameter), null); ArrayList<Message> messages = new ArrayList<Message>(); messages.add(mess); mapOfStringObject.put("messages", messages); @@ -254,6 +254,14 @@ mapOfSpecificParameter, mapOfOutputParameter); } + if (aUnicornCall.getTask() == null) { + aUnicornCall.setTask(Framework.mapOfTask.getDefaultTaskId()); + Message mess = new Message(Message.Level.WARNING, "$message_no_task " + Framework.mapOfTask.get(Framework.mapOfTask.getDefaultTaskId()).getLongName(langParameter), null); + ArrayList<Message> messages = new ArrayList<Message>(); + messages.add(mess); + mapOfStringObject.put("messages", messages); + } + try { aUnicornCall.doTask();
Received on Wednesday, 2 September 2009 10:40:56 UTC