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

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 UTC