- From: Hiep Duong via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 20 Feb 2008 15:10:01 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/org/w3c/unicorn/util
In directory hutz:/tmp/cvs-serv30553/org/w3c/unicorn/util
Modified Files:
LocalizedString.java
Log Message:
simplified observationresponse and generalize output format (now we can map a format type what defnied in the contract to a ResponseParser)
Index: LocalizedString.java
===================================================================
RCS file: /sources/public/2006/unicorn/org/w3c/unicorn/util/LocalizedString.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- LocalizedString.java 29 Sep 2006 09:25:12 -0000 1.2
+++ LocalizedString.java 20 Feb 2008 15:09:59 -0000 1.3
@@ -29,6 +29,11 @@
this.mapOfString = new LinkedHashMap<String, String>();
}
+ public LocalizedString (String s, String lang) {
+ this();
+ mapOfString.put(lang, s);
+ }
+
public boolean hasLocale (final String sLocale) {
return null != this.mapOfString.get(sLocale);
}
@@ -56,8 +61,18 @@
return this.mapOfString.keySet();
}
+ // return the message in DEFAULT_LANGUAGE (en) or in the first language in
+ // the list
public String toString () {
- return this.mapOfString.get(LocalizedString.DEFAULT_LANGUAGE);
+ String res = this.mapOfString.get(LocalizedString.DEFAULT_LANGUAGE);
+ if (res==null) {
+ for (String s: this.mapOfString.values()) {
+ return s;
+ }
+ }
+ if (res==null)
+ return "";
+ return res;
}
}
Received on Wednesday, 20 February 2008 15:10:10 UTC