W3C home > Mailing lists > Public > www-validator-cvs@w3.org > March 2010

2006/unicorn/src/org/w3c/unicorn/action LanguageAction.java,1.21,1.22

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 05 Mar 2010 15:13:20 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1NnZDM-0000bx-M9@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv2329/src/org/w3c/unicorn/action

Modified Files:
	LanguageAction.java 
Log Message:
Fixed: submitted tasklist properties were not automatically populated upon error
Fixed: compute of the number of lacking properties did not take into account tasklist properties

Index: LanguageAction.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/LanguageAction.java,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- LanguageAction.java	5 Mar 2010 14:06:08 -0000	1.21
+++ LanguageAction.java	5 Mar 2010 15:13:18 -0000	1.22
@@ -113,20 +113,23 @@
 					Templates.write("language.vm", velocityContext, writer);
 					writer.close(); return;
 				} else {
-					int missings = defaultProperties.size() - languageProperties.get(langParameter).size();
+					int missings = defaultProperties.size() - languageProperties.get(langParameter).size() + defaultMetadatas.size() - metadataProperties.get(langParameter).size();
 					
 					if (missings > 0)
-						messages.add(new Message(Message.INFO, "This translation lacks " + (defaultProperties.size() - languageProperties.get(langParameter).size()) + " properties. Help us to improve it."));
+						messages.add(new Message(Message.INFO, "This translation lacks " + missings + " properties. Help us to improve it."));
 					else 
 						messages.add(new Message(Message.INFO, "This translation is complete but you can help us to improve it if needed."));
 				}
 				if (req.getAttribute("submitted_props") != null) {
 					Properties submittedProps = (Properties) req.getAttribute("submitted_props");
 					velocityContext.put("prop", submittedProps);
-				} else {
+				} else
 					velocityContext.put("prop", languageProperties.get(langParameter));
+				if (req.getAttribute("submitted_metas") != null) {
+					Properties submittedMetas = (Properties) req.getAttribute("submitted_metas");
+					velocityContext.put("metadatas", submittedMetas);
+				} else
 					velocityContext.put("metadatas", metadataProperties.get(langParameter));
-				}
 			} else if (Language.isISOLanguageCode(langParameter)) {
 				Locale locale = Language.getLocale(langParameter);
 				if (locale == null) {
@@ -256,6 +259,7 @@
 				messages.add(new Message(Message.WARNING, "Please enter your name and your email address so we can contact you."));
 				req.setAttribute("messages", messages);
 				req.setAttribute("submitted_props", langProps);
+				req.setAttribute("submitted_metas", metaProps);
 				req.setAttribute("translator_name", req.getParameter("translator_name"));
 				req.setAttribute("translator_mail", req.getParameter("translator_mail"));
 				req.setAttribute("translator_comments", req.getParameter("translator_comments"));
@@ -271,6 +275,7 @@
 				messages.add(new Message(Message.WARNING, "The email address you entered is invalid."));
 				req.setAttribute("messages", messages);
 				req.setAttribute("submitted_props", langProps);
+				req.setAttribute("submitted_metas", metaProps);
 				req.setAttribute("translator_name", req.getParameter("translator_name"));
 				req.setAttribute("translator_mail", req.getParameter("translator_mail"));
 				req.setAttribute("translator_comments", req.getParameter("translator_comments"));
Received on Friday, 5 March 2010 15:13:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:55:19 GMT