- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 12 Oct 2009 15:22:41 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/util
In directory hutz:/tmp/cvs-serv30364/src/org/w3c/unicorn/util
Modified Files:
Language.java
Log Message:
added getAvailableLocales method that returns a TreeMap of installed locales (key: iso639-1code, value: displayLanguage() in the locale language)
Index: Language.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/util/Language.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- Language.java 9 Oct 2009 15:00:45 -0000 1.13
+++ Language.java 12 Oct 2009 15:22:39 -0000 1.14
@@ -9,6 +9,7 @@
import java.util.Enumeration;
import java.util.Locale;
import java.util.Properties;
+import java.util.TreeMap;
import org.apache.commons.lang.StringUtils;
import org.apache.velocity.VelocityContext;
@@ -125,5 +126,15 @@
}
return result;
}
+
+ public static TreeMap<String, String> getAvailablesLocales() {
+ Locale[] locales= Locale.getAvailableLocales();
+ TreeMap<String, String> result = new TreeMap<String, String>();
+ for (Locale loc : locales) {
+ if (!loc.getLanguage().equals(Property.get("DEFAULT_LANGUAGE")))
+ result.put(loc.getLanguage(), StringUtils.capitalize(loc.getDisplayLanguage(loc)));
+ }
+ return result;
+ }
}
Received on Monday, 12 October 2009 15:22:45 UTC