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

2006/unicorn/src/org/w3c/unicorn/action Action.java,1.12,1.13

From: Thomas Gambet via cvs-syncmail <cvsmail@w3.org>
Date: Wed, 30 Sep 2009 13:35:34 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1MszLC-0007ZQ-8Q@lionel-hutz.w3.org>
Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/action
In directory hutz:/tmp/cvs-serv29086/src/org/w3c/unicorn/action

Modified Files:
	Action.java 
Log Message:
added messages in case the lang parameter does not represent a real language ISO code or if unicorn does not support this language

Index: Action.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/action/Action.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- Action.java	24 Sep 2009 17:34:59 -0000	1.12
+++ Action.java	30 Sep 2009 13:35:32 -0000	1.13
@@ -58,9 +58,16 @@
 	public String getLanguage(String langParameter, HttpServletRequest req, ArrayList<Message> messages) {
 		
 		String lang;
-		if (langParameter == null || !Framework.getLanguageProperties().containsKey(langParameter))
+		if (langParameter == null || !Framework.getLanguageProperties().containsKey(langParameter)) {
 			lang = Language.negociate(req.getLocales());
-		else
+			if (langParameter != null && !Framework.getLanguageProperties().containsKey(langParameter)) {
+				if (Language.isISOLanguageCode(langParameter)) {
+					messages.add(new Message(Message.Level.INFO, "$message_unavailable_requested_language (" + langParameter + ")", null));
+				} else {
+					messages.add(new Message(Message.Level.INFO, "$message_invalid_requested_language (" + langParameter + ")", null));
+				}
+			}
+		} else
 			lang = langParameter;
 		
 		if (messages == null)
Received on Wednesday, 30 September 2009 13:35:35 GMT

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