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

2006/unicorn/src/org/w3c/unicorn/util Language.java,1.10,1.11

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 07 Oct 2009 14:59:46 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MvXzW-0007Nc-QT@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/util
In directory hutz:/tmp/cvs-serv28354/src/org/w3c/unicorn/util

Modified Files:
	Language.java 
Log Message:
cleaner way to capitalize the language names

Index: Language.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/util/Language.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Language.java	7 Oct 2009 14:52:08 -0000	1.10
+++ Language.java	7 Oct 2009 14:59:44 -0000	1.11
@@ -9,6 +9,8 @@
 import java.util.Enumeration;
 import java.util.Locale;
 import java.util.Properties;
+
+import org.apache.commons.lang.StringUtils;
 import org.apache.velocity.VelocityContext;
 import org.w3c.unicorn.Framework;
 
@@ -75,10 +77,7 @@
 			UCNProperties props = new UCNProperties();
 			props.load(isr);
 			props.put("lang", localeString);
-			char[] languageArray = locale.getDisplayLanguage(locale).toCharArray();
-			languageArray[0] = Character.toUpperCase(languageArray[0]);
-			String language = new String(languageArray);
-			props.put("language", language);
+			props.put("language", StringUtils.capitalize(locale.getDisplayLanguage(locale)));
 			return props;
 		} catch (UnsupportedEncodingException e) {
 			// This should not happen
Received on Wednesday, 7 October 2009 14:59:50 GMT

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