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

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 UTC