- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Mon, 12 Oct 2009 15:26:48 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action In directory hutz:/tmp/cvs-serv30692/src/org/w3c/unicorn/action Modified Files: LanguageAction.java Log Message: added availableLocales to the context (TreeMap returned by Language.getAvailableLocales()) +Capitalizes language display names Index: LanguageAction.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/LanguageAction.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- LanguageAction.java 12 Oct 2009 13:14:34 -0000 1.11 +++ LanguageAction.java 12 Oct 2009 15:26:46 -0000 1.12 @@ -20,6 +20,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.velocity.VelocityContext; @@ -47,6 +48,8 @@ private static TreeMap<String, Properties> languageProperties; private static TreeMap<String, String> defaultProperties = new TreeMap<String, String>(); + + private static TreeMap<String, String> availableLocales; /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) @@ -76,6 +79,8 @@ velocityContext.put("queryString", "./"); velocityContext.put("messages", messages); velocityContext.put("baseUri", "./"); + velocityContext.put("availableLocales", availableLocales); + Hashtable<String, String> languages = new Hashtable<String, String>(); languages.put(defaultLang, defaultProperties.get("language")); @@ -234,7 +239,7 @@ if (locale == null) return null; props.put("lang", locale.getLanguage()); - props.put("language", locale.getDisplayLanguage(locale)); + props.put("language", StringUtils.capitalize(locale.getDisplayLanguage(locale))); return props; } @@ -265,4 +270,12 @@ } } + public static TreeMap<String, String> getAvailableLocales() { + return availableLocales; + } + + public static void setAvailableLocales(TreeMap<String, String> availableLocales) { + LanguageAction.availableLocales = availableLocales; + } + }
Received on Monday, 12 October 2009 15:26:50 UTC