- From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
- Date: Tue, 23 Mar 2010 12:36:08 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action In directory hutz:/tmp/cvs-serv7276/src/org/w3c/unicorn/action Modified Files: Action.java Log Message: If a browser does not specify a "Accept-Language" header serve Unicorn in the default language Index: Action.java =================================================================== RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/Action.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Action.java 20 Mar 2010 17:02:10 -0000 1.20 +++ Action.java 23 Mar 2010 12:36:06 -0000 1.21 @@ -75,8 +75,13 @@ return matchedLocale; } } else { - browserLocale = Language.getAvailableLocale(req.getHeader("Accept-Language")); - matchedLocale = Language.getUILocale(req.getHeader("Accept-Language")); + if (req.getHeader("Accept-Language") != null) { + browserLocale = Language.getAvailableLocale(req.getHeader("Accept-Language")); + matchedLocale = Language.getUILocale(req.getHeader("Accept-Language")); + } else { + return Language.getDefaultLocale(); + } + if (messages != null && browserLocale != matchedLocale) { messages.add(new Message(Message.INFO, "$message_unavailable_language", null, browserLocale.getDisplayName(browserLocale), "?" + Property.get("UNICORN_PARAMETER_PREFIX") + "lang=" + browserLocale.getName())); return matchedLocale;
Received on Tuesday, 23 March 2010 12:36:12 UTC