2002/css-validator/org/w3c/css/util Messages.java,1.3,1.4

Update of /sources/public/2002/css-validator/org/w3c/css/util
In directory hutz:/tmp/cvs-serv891

Modified Files:
	Messages.java 
Log Message:
New UTF8 Properties (added by Jean-Guilhem Rouel)

Index: Messages.java
===================================================================
RCS file: /sources/public/2002/css-validator/org/w3c/css/util/Messages.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- Messages.java	17 Jan 2005 02:50:12 -0000	1.3
+++ Messages.java	12 Jul 2005 13:13:10 -0000	1.4
@@ -6,6 +6,9 @@
 // Please first read the full copyright statement in file COPYRIGHT.html
 /*
  * $Log$
+ * Revision 1.4  2005/07/12 13:13:10  ylafon
+ * New UTF8 Properties (added by Jean-Guilhem Rouel)
+ *
  * Revision 1.3  2005/01/17 02:50:12  ot
  * adding spanish as a potential message lang - thanks Carlos Iglesias
  *
@@ -16,10 +19,9 @@
 
 package org.w3c.css.util;
 
-import java.util.Properties;
+import java.net.URL;
 import java.util.Hashtable;
 import java.util.StringTokenizer;
-import java.net.URL;
 
 /**
  * @version $Revision$
@@ -29,7 +31,7 @@
     /**
      * Message properties
      */  
-    public Properties properties;
+	public Utf8Properties properties;
 
     private static Hashtable languages = new Hashtable();
     
@@ -42,7 +44,7 @@
 	    
 	    while (lanTok.hasMoreTokens()) {
 		String l = lanTok.nextToken().trim().toLowerCase();
-		properties = (Properties) languages.get(l);
+				properties = (Utf8Properties) languages.get(l);
 		if (properties != null) {
 		    break;
 		}
@@ -50,7 +52,7 @@
 		if (minusIndex != -1) {
 		    // suppressed -cn in zh-cn (example)
 		    l = l.substring(0, minusIndex);
-		    properties = (Properties) languages.get(l);
+					properties = (Utf8Properties) languages.get(l);
 		}
 		if (properties != null) {
 		    break;
@@ -58,11 +60,10 @@
 	    }
 	}
 	if (properties == null) {
-	    properties = (Properties) languages.get("en");
+			properties = (Utf8Properties) languages.get("en");
 	}
     }
     
-    
     /**
      * Get a property.
      */  
@@ -73,25 +74,30 @@
     /**
      * Get a warning property.
      * 
-     * @param message the warning property.
+	 * @param message
+	 *            the warning property.
      */  
     public String getWarningString(String message) {
-	return getString(new StringBuffer("warning.").append(message).toString());
+		return getString(new StringBuffer("warning.").append(message)
+				.toString());
     }
     
     /**
      * Get a warning level property.
      * 
-     * @param message the warning property.
+	 * @param message
+	 *            the warning property.
      */  
     public String getWarningLevelString(String message) {
-	return getString(new StringBuffer("warning.").append(message).append(".level").toString());
+		return getString(new StringBuffer("warning.").append(message).append(
+				".level").toString());
     }
     
     /**
      * Get an error property.
      *
-     * @param message the error property.
+	 * @param message
+	 *            the error property.
      */  
     public String getErrorString(String message) {
 	return getString(new StringBuffer("error.").append(message).toString());
@@ -100,24 +106,28 @@
     /**
      * Get an generator property.
      *
-     * @param message the generator property.
+	 * @param message
+	 *            the generator property.
      */  
     public String getGeneratorString(String message) {
-	return getString(new StringBuffer("generator.").append(message).toString());
+		return getString(new StringBuffer("generator.").append(message)
+				.toString());
     }
     
     /**
      * Get an generator property.
      *
-     * @param message the generator property.
+	 * @param message
+	 *            the generator property.
      */  
     public String getGeneratorString(String message, String param) {
-	String str = getString(new StringBuffer("generator.").append(message).toString());
+		String str = getString(new StringBuffer("generator.").append(message)
+				.toString());
 	
 	// replace all parameters
 	int i = str.indexOf("%s");
 	if (i >= 0) {
-	    str = str.substring(0, i) + param + str.substring(i+2);
+			str = str.substring(0, i) + param + str.substring(i + 2);
 	}
 	return str;
     }
@@ -125,64 +135,69 @@
     /**
      * Get an generator property.
      *
-     * @param message the generator property.
+	 * @param message
+	 *            the generator property.
      */  
     public String getServletString(String message) {
-	return getString(new StringBuffer("servlet.").append(message).toString());
+		return getString(new StringBuffer("servlet.").append(message)
+				.toString());
     }
     
     static {
-	Properties tmp;
+		Utf8Properties tmp;
 	try {
 	    URL url = Messages.class.getResource("Messages.properties.en");
 	    java.io.InputStream f = url.openStream();
 	    try {
-		tmp = new Properties();
+				tmp = new Utf8Properties();
 		tmp.load(f);
 		languages.put("en", tmp);
 	    } finally {
 		f.close();
 	    }
 	} catch (Exception e) {
-	    System.err.println("org.w3c.css.util.Messages: couldn't load properties en");
-	    System.err.println("  " + e.toString() );
+			System.err
+					.println("org.w3c.css.util.Messages: couldn't load properties en");
+			System.err.println("  " + e.toString());
 	}
 
 	try {
 	    URL url = Messages.class.getResource("Messages.properties.zh-cn");
 	    java.io.InputStream f = url.openStream();
 	    try {
-		tmp = new Properties();
+				tmp = new Utf8Properties();
 		tmp.load(f);
 		languages.put("zh-cn", tmp);
 	    } finally {
 		f.close();
 	    }
 	} catch (Exception e) {
-	    System.err.println("org.w3c.css.util.Messages: couldn't load properties cn");
-	    System.err.println("  " + e.toString() );
+			System.err
+					.println("org.w3c.css.util.Messages: couldn't load properties cn");
+			System.err.println("  " + e.toString());
 	}
 
 	try {
 	    URL url = Messages.class.getResource("Messages.properties.ja");
 	    java.io.InputStream f = url.openStream();
 	    try {
-		tmp = new Properties();
+				tmp = new Utf8Properties();
 		tmp.load(f);
 		languages.put("ja", tmp);
 	    } finally {
 		f.close();
 	    }
 	} catch (Exception e) {
-	    System.err.println("org.w3c.css.util.Messages: couldn't load properties ja");
-	    System.err.println("  " + e.toString() );
+			System.err
+					.println("org.w3c.css.util.Messages: couldn't load properties ja");
+			System.err.println("  " + e.toString());
 	}
 
         try {
             URL url = Messages.class.getResource("Messages.properties.fr");
             java.io.InputStream f = url.openStream();
             try {
-                tmp = new Properties();
+				tmp = new Utf8Properties();
                 tmp.load(f);
                 languages.put("fr", tmp);
 		languages.put("fr_FR", tmp);
@@ -190,17 +205,18 @@
                 f.close();
             }
         } catch (Exception e) {
-            System.err.println("org.w3c.css.util.Messages: couldn't load properties fr");
-            System.err.println("  " + e.toString() );
+			System.err
+					.println("org.w3c.css.util.Messages: couldn't load properties fr");
+			System.err.println("  " + e.toString());
         }
 
-	//-----------------------
+		// -----------------------
 
         try {
             URL url = Messages.class.getResource("Messages.properties.de");
             java.io.InputStream f = url.openStream();
             try {
-                tmp = new Properties();
+				tmp = new Utf8Properties();
                 tmp.load(f);
                 languages.put("de", tmp);
                 languages.put("de_DE", tmp);
@@ -210,8 +226,9 @@
                 f.close();
             }
 	} catch (Exception e) {
-            System.err.println("org.w3c.css.util.Messages: couldn't load properties de");
-            System.err.println("  " + e.toString() );
+			System.err
+					.println("org.w3c.css.util.Messages: couldn't load properties de");
+			System.err.println("  " + e.toString());
         }
 
 	// ------------------------------------------------
@@ -220,15 +237,16 @@
 	    URL url = Messages.class.getResource("Messages.properties.nl");
 	    java.io.InputStream f = url.openStream();
 	    try {
-		tmp = new Properties();
+				tmp = new Utf8Properties();
 		tmp.load(f);
 		languages.put("nl", tmp);
 	    } finally {
 		f.close();
 	    }
 	} catch (Exception e) {
-	    System.err.println("org.w3c.css.util.Messages: couldn't load properties nl");
-	    System.err.println("  " + e.toString() );
+			System.err
+					.println("org.w3c.css.util.Messages: couldn't load properties nl");
+			System.err.println("  " + e.toString());
 	}
 
 	// ------------------------------------------------
@@ -237,7 +255,7 @@
 	    URL url = Messages.class.getResource("Messages.properties.es");
 	    java.io.InputStream f = url.openStream();
 	    try {
-		tmp = new Properties();
+				tmp = new Utf8Properties();
 		tmp.load(f);
 		languages.put("es", tmp);
 		languages.put("es_ES", tmp);
@@ -245,10 +263,10 @@
 		f.close();
 	    }
 	} catch (Exception e) {
-	    System.err.println("org.w3c.css.util.Messages: couldn't load properties es");
-	    System.err.println("  " + e.toString() );
+			System.err
+					.println("org.w3c.css.util.Messages: couldn't load properties es");
+			System.err.println("  " + e.toString());
 	}
 
-
     }
 }

Received on Tuesday, 12 July 2005 13:13:16 UTC