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

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/util
In directory hutz:/tmp/cvs-serv27132/src/org/w3c/unicorn/util

Modified Files:
	Language.java 
Log Message:
the language name is automatically added to language properties at runtime

Index: Language.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/util/Language.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- Language.java	7 Oct 2009 12:49:30 -0000	1.9
+++ Language.java	7 Oct 2009 14:52:08 -0000	1.10
@@ -66,6 +66,8 @@
 		if (!Language.isISOLanguageCode(localeString))
 			throw new IllegalArgumentException("Invalid language file: " + langFile + ". " + localeString + " is not a valid ISO language code. This file will not be loaded.");
 
+		Locale locale = Language.getLocale(localeString);
+		
 		FileInputStream fis = new FileInputStream(langFile);
 		InputStreamReader isr;
 		try {
@@ -73,6 +75,10 @@
 			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);
 			return props;
 		} catch (UnsupportedEncodingException e) {
 			// This should not happen

Received on Wednesday, 7 October 2009 14:52:12 UTC