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

2006/unicorn/src/org/w3c/unicorn/util Language.java,1.17,1.18

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 05 Mar 2010 15:11:10 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1NnZBG-0000SK-DZ@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/util
In directory hutz:/tmp/cvs-serv1716/src/org/w3c/unicorn/util

Modified Files:
	Language.java 
Log Message:
Fixed : Now also checks that tasklist properties are complete before considering a language complete

Index: Language.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/util/Language.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- Language.java	3 Mar 2010 17:20:43 -0000	1.17
+++ Language.java	5 Mar 2010 15:11:08 -0000	1.18
@@ -56,10 +56,10 @@
 	}
 
 	public static void complete(Properties props, Properties defaultProps) {
-		props.put("complete", "true");
+		//props.put("complete", "true");
 		for (Object key : defaultProps.keySet()) {
-			if (!props.containsKey(key)) {
-				props.put("complete", "false");
+			if (!props.containsKey(key) && key != "complete") {
+				//props.put("complete", "false");
 				//props.put(key, "<span dir=\"" + defaultProps.get("direction") + "\" xml:lang=\"" + defaultProps.get("lang") + "\">" + defaultProps.get(key) + "</span>");
 				props.put(key, defaultProps.get(key));
 				Framework.logger.warn(">> Missing property in " + props.getProperty("lang") + ".properties for key: \"" + (String) key + "\". Added default property for this key: \"" + defaultProps.get(key) + "\""); 
@@ -105,17 +105,25 @@
 
 	public static boolean isComplete(String langParameter) {
 		Properties testedProps = Framework.getLanguageProperties().get(langParameter);
+		Properties testedMetadataProps = Framework.getMetadataProperties().get(langParameter);
 		
 		if (testedProps.get("complete") == null) {
 			for (Object key : Framework.getLanguageProperties().get(Property.get("DEFAULT_LANGUAGE")).keySet()) {
-				if (!testedProps.containsKey(key)) {
+				if (!testedProps.containsKey(key) && key != "complete") {
+					testedProps.put("complete", "false");
+					return false;
+				}
+			}
+			for (Object key : Framework.getMetadataProperties().get(Property.get("DEFAULT_LANGUAGE")).keySet()) {
+				if (!testedMetadataProps.containsKey(key)) {
 					testedProps.put("complete", "false");
 					return false;
 				}
 			}
 			return true;
-		} else
+		} else {
 			return testedProps.get("complete").equals("true");
+		}
 	}
 	
 	public static String evaluate(String lang, String messageKey, String... args) {
Received on Friday, 5 March 2010 15:11:14 GMT

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