- From: Yves Lafon via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 05 Jan 2010 13:50:02 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2002/css-validator/org/w3c/css/util In directory hutz:/tmp/cvs-serv25562/org/w3c/css/util Modified Files: CompareFunction.java FakeFile.java InvalidParamException.java Messages.java Warning.java Log Message: Implementation of css3-background (partial, missing background-color and background, also borders not done) cf. http://www.w3.org/TR/2009/CR-css3-background-20091217/ moved and corrected implementation of css3-multicol cf. http://www.w3.org/TR/2009/CR-css3-multicol-20091217/ Some reorganization of code. Index: FakeFile.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/util/FakeFile.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- FakeFile.java 15 Feb 2009 18:23:48 -0000 1.7 +++ FakeFile.java 5 Jan 2010 13:50:00 -0000 1.8 @@ -15,118 +15,115 @@ */ public class FakeFile { - protected String fileName, contentType; + protected String fileName, contentType; - /** - * The array buffer into which the components of this object are - * stored. The capacity of this object is the length of this array buffer. - */ - protected byte[] data; + /** + * The array buffer into which the components of this object are + * stored. The capacity of this object is the length of this array buffer. + */ + protected byte[] data; - /** - * The number of valid components in the vector. - */ - protected int count; + /** + * The number of valid components in the vector. + */ + protected int count; - /** - * Create a new FakeFile. - * - * @param name the file name. - */ - public FakeFile(String fileName) { - this.fileName = fileName; - this.contentType = "none"; - data = new byte[255]; - } + /** + * Create a new FakeFile. + * + * @param fileName the file name. + */ + public FakeFile(String fileName) { + this.fileName = fileName; + this.contentType = "none"; + data = new byte[255]; + } - /** - * Returns the name of the file represented by this object. - * - * @return the name of the file represented by this <code>File</code> - * object. - */ - public String getName() { - return fileName; - } + /** + * Returns the name of the file represented by this object. + * + * @return the name of the file represented by this <code>File</code> + * object. + */ + public String getName() { + return fileName; + } - /** - * Gets an InputStream for this fake file. - * - * @return the input stream of this fake file or <code>null</code> if no - * data are available. - */ - public synchronized InputStream getInputStream() throws IOException { - if (count > 0) { - trimToSize(); - return new ByteArrayInputStream(data); - } else { - return null; + /** + * Gets an InputStream for this fake file. + * + * @return the input stream of this fake file or <code>null</code> if no + * data are available. + */ + public synchronized InputStream getInputStream() throws IOException { + if (count > 0) { + trimToSize(); + return new ByteArrayInputStream(data); + } else { + return null; + } } - } - /** - * Get the data size of this fake file - */ - public synchronized int getSize() { - return count; - } + /** + * Get the data size of this fake file + */ + public synchronized int getSize() { + return count; + } - /** - * Trims the capacity of this object to be this object's current - * size. An application can use this operation to minimize the - * storage of a fake file. - */ - public final synchronized void trimToSize() { - int oldCapacity = data.length; - if (count < oldCapacity) { - byte oldData[] = data; - data = new byte[count]; - System.arraycopy(oldData, 0, data, 0, count); + /** + * Trims the capacity of this object to be this object's current + * size. An application can use this operation to minimize the + * storage of a fake file. + */ + public final synchronized void trimToSize() { + int oldCapacity = data.length; + if (count < oldCapacity) { + byte oldData[] = data; + data = new byte[count]; + System.arraycopy(oldData, 0, data, 0, count); + } } - } - /** - * Increases the capacity of this object, if necessary, to ensure - * that it can hold at least the number of components specified by - * the minimum capacity argument. - * - * @param minCapacity the desired minimum capacity. - */ - private final synchronized void ensureCapacity(int minCapacity) { - int oldCapacity = data.length; - if (minCapacity > oldCapacity) { - byte oldData[] = data; - data = new byte[minCapacity]; - System.arraycopy(oldData, 0, data, 0, count); + /** + * Increases the capacity of this object, if necessary, to ensure + * that it can hold at least the number of components specified by + * the minimum capacity argument. + * + * @param minCapacity the desired minimum capacity. + */ + private final synchronized void ensureCapacity(int minCapacity) { + int oldCapacity = data.length; + if (minCapacity > oldCapacity) { + byte oldData[] = data; + data = new byte[minCapacity]; + System.arraycopy(oldData, 0, data, 0, count); + } } - } - /** - * Writes <code>len</code> bytes from the specified byte array - * starting at offset <code>off</code> to this fake file. - * - * @param b the data. - * @param off the start offset in the data. - * @param len the number of bytes to write. - * - * @exception IOException if an I/O error occurs. - */ - public void write(byte[] data, int start, int len) { - if (len <= 0) - return; - ensureCapacity(count + len); - for (int i = 0; i < len; i++) { - this.data[count+i] = data[i+start]; + /** + * Writes <code>len</code> bytes from the specified byte array + * starting at offset <code>off</code> to this fake file. + * + * @param data the data. + * @param start the start offset in the data. + * @param len the number of bytes to write. + * @throws IOException if an I/O error occurs. + */ + public void write(byte[] data, int start, int len) { + if (len <= 0) + return; + ensureCapacity(count + len); + System.arraycopy(data, start, this.data, count, len); + count += len; } - count += len; - } public void setContentType(String mimeType) { - contentType = mimeType; + contentType = mimeType; } - + public String getContentType() { - return contentType; + return contentType; } } Index: InvalidParamException.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/util/InvalidParamException.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- InvalidParamException.java 24 Feb 2009 23:25:58 -0000 1.9 +++ InvalidParamException.java 5 Jan 2010 13:50:00 -0000 1.10 @@ -18,7 +18,7 @@ * Create a new InvalidParamException. */ public InvalidParamException() { - super(); + super(); } /** @@ -27,82 +27,81 @@ * @param message the error message */ public InvalidParamException(String message, ApplContext ac) { - super(ac.getMsg().getErrorString((message != null)? message : "")); + super(ac.getMsg().getErrorString((message != null) ? message : "")); } /** * Create a new InvalidParamException with an error message class. * - * @param error the error message class. + * @param error the error message class. * @param message a message to add */ public InvalidParamException(String error, Object message, ApplContext ac) { - super(processError(error, (message != null)?message:null, ac)); + super(processError(error, (message != null) ? message : null, ac)); } /** * Create a new InvalidParamException. * - * @param error the error message class + * @param error the error message class * @param message1 the first message to add * @param message1 the second message to add */ public InvalidParamException(String error, Object message1, - Object message2, ApplContext ac) { - super(processError(error, - (message1 != null)?message1.toString():null, - (message2 != null)?message2.toString():null, - ac)); + Object message2, ApplContext ac) { + super(processError(error, + (message1 != null) ? message1.toString() : null, + (message2 != null) ? message2.toString() : null, + ac)); } - + private static String processError(String error, Object args, ApplContext ac) { - if (args instanceof String[]) { - String[] s_args = (String[]) args; - StringBuilder sb = new StringBuilder(); - String str = null; + if (args instanceof String[]) { + String[] s_args = (String[]) args; + StringBuilder sb = new StringBuilder(); + String str = null; - if (error != null) { - str = ac.getMsg().getErrorString(error); - } - if (str == null) { - return "can't find the error message for " + error; - } else { - // replace all parameters - String[] msg_parts = str.split("%s"); - int j = 0; - sb.append(msg_parts[0]); - for (int i = 1; i< msg_parts.length; i++) { - if (j < s_args.length) { - sb.append(s_args[j++]); - } - sb.append(msg_parts[i]); - } - return sb.toString(); - } - } else { - return processError(error, args.toString(), "", ac); - } + if (error != null) { + str = ac.getMsg().getErrorString(error); + } + if (str == null) { + return "can't find the error message for " + error; + } else { + // replace all parameters + String[] msg_parts = str.split("%s"); + int j = 0; + sb.append(msg_parts[0]); + for (int i = 1; i < msg_parts.length; i++) { + if (j < s_args.length) { + sb.append(s_args[j++]); + } + sb.append(msg_parts[i]); + } + return sb.toString(); + } + } else { + return processError(error, args.toString(), "", ac); + } } - - + private static String processError(String error, String arg1, - String arg2, ApplContext ac) { - String str = null; + String arg2, ApplContext ac) { + String str = null; - if (error != null) { - str = ac.getMsg().getErrorString(error); - } - if (str == null) { - return "can't find the error message for " + error; - } else { - // replace all parameters - for (int i = 0; (i = str.indexOf("%s")) >= 0 ; ) { - str = str.substring(0, i) + arg1 + str.substring(i+2); - arg1 = arg2; - } - return str; - } + if (error != null) { + str = ac.getMsg().getErrorString(error); + } + if (str == null) { + return "can't find the error message for " + error; + } else { + // replace all parameters + for (int i = 0; (i = str.indexOf("%s")) >= 0;) { + str = str.substring(0, i) + arg1 + str.substring(i + 2); + arg1 = arg2; + } + return str; + } } } // InvalidParamException Index: Warning.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/util/Warning.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Warning.java 25 Feb 2009 20:44:50 -0000 1.10 +++ Warning.java 5 Jan 2010 13:50:00 -0000 1.11 @@ -7,7 +7,7 @@ package org.w3c.css.util; import org.w3c.css.parser.CssSelectors; -import org.w3c.css.properties.css1.CssProperty; +import org.w3c.css.properties.css.CssProperty; /** * This class is use to manage all warning every where @@ -109,7 +109,7 @@ * @param level the warning level * * @see org.w3c.css.util.Messages - * @see org.w3c.css.properties.css1.CssProperty#setInfo + * @see org.w3c.css.properties.css.CssProperty#setInfo */ public Warning(CssProperty property, String warningMessage, int level, ApplContext ac) { Index: Messages.java =================================================================== RCS file: /sources/public/2002/css-validator/org/w3c/css/util/Messages.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- Messages.java 18 Dec 2009 16:37:11 -0000 1.37 +++ Messages.java 5 Jan 2010 13:50:00 -0000 1.38 @@ -7,11 +7,9 @@ package org.w3c.css.util; -import java.net.MalformedURLException; -import java.net.URL; import java.util.ArrayList; -import java.util.Iterator; import java.util.Hashtable; +import java.util.Iterator; import java.util.StringTokenizer; import java.util.Vector; @@ -23,162 +21,167 @@ /** * Message properties */ - public Utf8Properties<String,String> properties; - - public static Hashtable<String, Utf8Properties<String,String>> languages = new Hashtable<String, Utf8Properties<String,String>>(); - public static ArrayList<String> languages_name = new ArrayList<String>(); - + public Utf8Properties<String, String> properties; + + public static Hashtable<String, Utf8Properties<String, String>> languages; + public static ArrayList<String> languages_name; + /** * Creates a new Messages */ public Messages(String lang) { - if (lang != null) { - StringTokenizer lanTok = new StringTokenizer(lang, ","); - int maxTok = lanTok.countTokens(); + if (lang != null) { + StringTokenizer lanTok = new StringTokenizer(lang, ","); + int maxTok = lanTok.countTokens(); - String slang[] = new String[maxTok]; - float qlang[] = new float[maxTok]; + String slang[] = new String[maxTok]; + float qlang[] = new float[maxTok]; - // quick and dirty, it would be better to use Jigsaw's classes - while (lanTok.hasMoreTokens()) { - String l = lanTok.nextToken().trim().toLowerCase(); - int qualsep = l.indexOf(';'); - float qval = 1; - if (qualsep != -1) { - String p = l.substring(qualsep + 1); - l = l.substring(0, qualsep); - if (p.startsWith("q=")) { - qval = Float.parseFloat(p.substring(2)); - } - } - for (int i = 0; i < maxTok; i++) { - if (slang[i] == null) { - slang[i] = l; - qlang[i] = qval; - break; - } else if (qval > qlang[i]) { - System.arraycopy(slang, i, slang, i + 1, (maxTok - i - 1)); - System.arraycopy(qlang, i, qlang, i + 1, (maxTok - i - 1)); - slang[i] = l; - qlang[i] = qval; - break; - } + // quick and dirty, it would be better to use Jigsaw's classes + while (lanTok.hasMoreTokens()) { + String l = lanTok.nextToken().trim().toLowerCase(); + int qualsep = l.indexOf(';'); + float qval = 1; + if (qualsep != -1) { + String p = l.substring(qualsep + 1); + l = l.substring(0, qualsep); + if (p.startsWith("q=")) { + qval = Float.parseFloat(p.substring(2)); + } + } + for (int i = 0; i < maxTok; i++) { + if (slang[i] == null) { + slang[i] = l; + qlang[i] = qval; + break; + } else if (qval > qlang[i]) { + System.arraycopy(slang, i, slang, i + 1, (maxTok - i - 1)); + System.arraycopy(qlang, i, qlang, i + 1, (maxTok - i - 1)); + slang[i] = l; + qlang[i] = qval; + break; + } - } - } - for (int i = 0; i < maxTok; i++) { - String l = slang[i]; - properties = languages.get(l); - if (properties != null) { - break; - } - int minusIndex = l.indexOf('-'); - if (minusIndex != -1) { - // suppressed -cn in zh-cn (example) - l = l.substring(0, minusIndex); - properties = languages.get(l); - } - if (properties != null) { - break; - } - } - } - if (properties == null) { - properties = languages.get("en"); - } + } + } + for (int i = 0; i < maxTok; i++) { + String l = slang[i]; + properties = languages.get(l); + if (properties != null) { + break; + } + int minusIndex = l.indexOf('-'); + if (minusIndex != -1) { + // suppressed -cn in zh-cn (example) + l = l.substring(0, minusIndex); + properties = languages.get(l); + } + if (properties != null) { + break; + } + } + } + if (properties == null) { + properties = languages.get("en"); + } } /** * Get a property. */ public String getString(String message) { - return properties.getProperty(message); + return properties.getProperty(message); } /** * Get a warning property. - * - * @param message - * the warning property. + * + * @param message the warning property. */ public String getWarningString(String message) { - return getString("warning."+message); + return getString("warning." + message); } /** * Get a warning level property. - * - * @param message - * the warning property. + * + * @param message the warning property. */ public String getWarningLevelString(String message) { - return getString(new StringBuilder("warning.").append(message).append(".level").toString()); + return getString(new StringBuilder("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("error."+message); + return getString("error." + message); } /** * Get an generator property. - * - * @param message - * the generator property. + * + * @param message the generator property. */ public String getGeneratorString(String message) { - return getString("generator."+message); + return getString("generator." + message); } /** * Get an generator property. - * - * @param message - * the generator property. + * + * @param message the generator property. */ public String getGeneratorString(String message, String param) { - String str = getString("generator."+message); + String str = getString("generator." + message); - // replace all parameters - int i = str.indexOf("%s"); - if (i >= 0) { - str = str.substring(0, i) + param + str.substring(i + 2); - } - return str; + // replace all parameters + int i = str.indexOf("%s"); + if (i >= 0) { + str = str.substring(0, i) + param + str.substring(i + 2); + } + return str; } /** * Get an generator property. - * - * @param message - * the generator property. + * + * @param message the generator property. */ public String getServletString(String message) { - return getString("servlet."+message); + return getString("servlet." + message); } /** * escape string */ static public String escapeString(String orig) { - if (orig != null) { + if (orig != null) { int len = orig.length(); - StringBuilder ret = new StringBuilder(len+16); + StringBuilder ret = new StringBuilder(len + 16); char c; - + for (int i = 0; i < len; i++) { switch (c = orig.charAt(i)) { - case '&' : ret.append("&"); break; - case '\'' : ret.append("'"); break; - case '"' : ret.append("""); break; - case '<' : ret.append("<"); break; - case '>' : ret.append(">"); break; - default : ret.append(c); + case '&': + ret.append("&"); + break; + case '\'': + ret.append("'"); + break; + case '"': + ret.append("""); + break; + case '<': + ret.append("<"); + break; + case '>': + ret.append(">"); + break; + default: + ret.append(c); } } return ret.toString(); @@ -187,334 +190,337 @@ } public String getString(String message, Vector<String> params) { - if ((params == null) || params.size() == 0) { - return getString(message); - } - String[] msg_parts = getString(message).split("%s"); - Iterator<String> param_it = params.iterator(); - StringBuilder sb = new StringBuilder(msg_parts[0]); - for (int i=1; i<msg_parts.length; i++) { - if (param_it.hasNext()) { - sb.append(param_it.next()); - } - sb.append(msg_parts[i]); - } - return sb.toString(); + if ((params == null) || params.size() == 0) { + return getString(message); + } + String[] msg_parts = getString(message).split("%s"); + Iterator<String> param_it = params.iterator(); + StringBuilder sb = new StringBuilder(msg_parts[0]); + for (int i = 1; i < msg_parts.length; i++) { + if (param_it.hasNext()) { + sb.append(param_it.next()); + } + sb.append(msg_parts[i]); + } + return sb.toString(); } static { - Utf8Properties<String,String> tmp; - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.de"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("de"); - languages.put("de", tmp); - languages.put("de_DE", tmp); - languages.put("de_AT", tmp); - languages.put("de_CH", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties de"); - System.err.println(" " + e.toString()); - } + languages = new Hashtable<String, Utf8Properties<String, String>>(); + languages_name = new ArrayList<String>(); - // ------------------------------------------------ + Utf8Properties<String, String> tmp; + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.de"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("de"); + languages.put("de", tmp); + languages.put("de_DE", tmp); + languages.put("de_AT", tmp); + languages.put("de_CH", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties de"); + System.err.println(" " + e.toString()); + } - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.en"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("en"); - 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()); - } + // ------------------------------------------------ - // ------------------------------------------------ + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.en"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("en"); + 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()); + } - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.es"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("es"); - languages.put("es", tmp); - languages.put("es_ES", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties es"); - System.err.println(" " + e.toString()); - } + // ------------------------------------------------ - // ----------------------- + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.es"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("es"); + languages.put("es", tmp); + languages.put("es_ES", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties es"); + System.err.println(" " + e.toString()); + } - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.fr"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("fr"); - languages.put("fr", tmp); - languages.put("fr_FR", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties fr"); - System.err.println(" " + e.toString()); - } + // ----------------------- - // ----------------------- + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.fr"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("fr"); + languages.put("fr", tmp); + languages.put("fr_FR", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties fr"); + System.err.println(" " + e.toString()); + } - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ko"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("ko"); - languages.put("ko", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties ko"); - System.err.println(" " + e.toString()); - } + // ----------------------- - // ----------------------- - - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.it"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("it"); - languages.put("it", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties it"); - System.err.println(" " + e.toString()); - } + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ko"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("ko"); + languages.put("ko", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties ko"); + System.err.println(" " + e.toString()); + } - // ----------------------- + // ----------------------- - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.nl"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("nl"); - 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()); - } + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.it"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("it"); + languages.put("it", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties it"); + System.err.println(" " + e.toString()); + } - // ----------------------- + // ----------------------- - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ja"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("ja"); - 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()); - } + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.nl"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("nl"); + 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()); + } - // ----------------------- - - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.pl-PL"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("pl-PL"); - languages.put("pl", tmp); - languages.put("pl_PL", tmp); - languages.put("pl-PL", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties pl"); - System.err.println(" " + e.toString()); - } + // ----------------------- - // ----------------------- - - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.pt-BR"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("pt-BR"); - languages.put("pt-br", tmp); - languages.put("pt-BR", tmp); - languages.put("pt_BR", tmp); - languages.put("pt", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties pt-br"); - System.err.println(" " + e.toString()); - } - // ----------------------- - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ru"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("ru"); - languages.put("ru", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties ru"); - System.err.println(" " + e.toString()); - } + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ja"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("ja"); + 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()); + } + + // ----------------------- - // ----------------------- - // disabled for the time being, the properties file has trouble with line breaks - // and the rtl text makes it difficult to fix with my editor. Ball is in the camp of translator 2009-03 -- olivier - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.fa"); try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("fa"); - languages.put("fa", tmp); - } finally { - f.close(); + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.pl-PL"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("pl-PL"); + languages.put("pl", tmp); + languages.put("pl_PL", tmp); + languages.put("pl-PL", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties pl"); + System.err.println(" " + e.toString()); } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties fa"); - System.err.println(" " + e.toString()); - } - // ----------------------- - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.sv"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("sv"); - languages.put("sv", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties sv"); - System.err.println(" " + e.toString()); - } + // ----------------------- - // ----------------------- - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.bg"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("bg"); - languages.put("bg", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties bg"); - System.err.println(" " + e.toString()); - } + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.pt-BR"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("pt-BR"); + languages.put("pt-br", tmp); + languages.put("pt-BR", tmp); + languages.put("pt_BR", tmp); + languages.put("pt", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties pt-br"); + System.err.println(" " + e.toString()); + } + // ----------------------- + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ru"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("ru"); + languages.put("ru", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties ru"); + System.err.println(" " + e.toString()); + } - // ----------------------- - // Ukrainian - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.uk"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("uk"); - languages.put("uk", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties uk"); - System.err.println(" " + e.toString()); - } + // ----------------------- + // disabled for the time being, the properties file has trouble with line breaks + // and the rtl text makes it difficult to fix with my editor. Ball is in the camp of translator 2009-03 -- olivier + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.fa"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("fa"); + languages.put("fa", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties fa"); + System.err.println(" " + e.toString()); + } - // ----------------------- - // Czech - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.cs"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("cs"); - languages.put("cs", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties cs"); - System.err.println(" " + e.toString()); - } + // ----------------------- + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.sv"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("sv"); + languages.put("sv", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties sv"); + System.err.println(" " + e.toString()); + } - // ----------------------- - // Romanian - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ro"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("ro"); - languages.put("ro", tmp); - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties ro"); - System.err.println(" " + e.toString()); - } + // ----------------------- + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.bg"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("bg"); + languages.put("bg", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties bg"); + System.err.println(" " + e.toString()); + } - // ----------------------- - // Chinese - try { - java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.zh-cn"); - try { - tmp = new Utf8Properties<String,String>(); - tmp.load(f); - languages_name.add("zh-cn"); - languages.put("zh-cn", tmp); - languages.put("zh", tmp); // for now we have no other - // alternative for chinese - } finally { - f.close(); - } - } catch (Exception e) { - System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties cn"); - System.err.println(" " + e.toString()); - } + // ----------------------- + // Ukrainian + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.uk"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("uk"); + languages.put("uk", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties uk"); + System.err.println(" " + e.toString()); + } + + // ----------------------- + // Czech + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.cs"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("cs"); + languages.put("cs", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties cs"); + System.err.println(" " + e.toString()); + } + + // ----------------------- + // Romanian + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.ro"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("ro"); + languages.put("ro", tmp); + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties ro"); + System.err.println(" " + e.toString()); + } + + // ----------------------- + // Chinese + try { + java.io.InputStream f = Messages.class.getResourceAsStream("Messages.properties.zh-cn"); + try { + tmp = new Utf8Properties<String, String>(); + tmp.load(f); + languages_name.add("zh-cn"); + languages.put("zh-cn", tmp); + languages.put("zh", tmp); // for now we have no other + // alternative for chinese + } finally { + f.close(); + } + } catch (Exception e) { + System.err.println("org.w3c.css.util.Messages: " + "couldn't load properties cn"); + System.err.println(" " + e.toString()); + } } }
Received on Tuesday, 5 January 2010 13:50:06 UTC