W3C home > Mailing lists > Public > www-validator-cvs@w3.org > September 2009

2006/unicorn/src/org/w3c/unicorn/util Language.java,1.4,1.5

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 30 Sep 2009 14:58:45 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1Mt0dh-0005tJ-NG@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/util
In directory hutz:/tmp/cvs-serv22631/src/org/w3c/unicorn/util

Modified Files:
	Language.java 
Log Message:
new getLocale method

Index: Language.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/util/Language.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Language.java	30 Sep 2009 09:44:28 -0000	1.4
+++ Language.java	30 Sep 2009 14:58:43 -0000	1.5
@@ -24,6 +24,15 @@
 		return false;
 	}
 	
+	public static Locale getLocale(String languageCode) {
+		Locale[] locales= Locale.getAvailableLocales();
+		for (Locale locale : locales) {
+			if (locale.getLanguage().equals(languageCode))
+				return locale;
+		}
+		return null;
+	}
+	
 	public static String negociate(Enumeration<?> locales) {
 		while (locales.hasMoreElements()) {
 			Locale loc = (Locale) locales.nextElement();
Received on Wednesday, 30 September 2009 14:58:46 GMT

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