diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-07-09 14:48:48 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-07-09 14:48:48 +0000 |
commit | 677021e29d773f51c3ffadbb75e6639eca01980f (patch) | |
tree | f8120fc0405f6c8499cf4405ba93a41170d2c9b2 /BKUOnline/src/main/webapp/help.jsp | |
parent | d972ac8a363476365077d4f4b7410a33cc321b17 (diff) | |
download | mocca-677021e29d773f51c3ffadbb75e6639eca01980f.tar.gz mocca-677021e29d773f51c3ffadbb75e6639eca01980f.tar.bz2 mocca-677021e29d773f51c3ffadbb75e6639eca01980f.zip |
[#379] Help does not work
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@406 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'BKUOnline/src/main/webapp/help.jsp')
-rw-r--r-- | BKUOnline/src/main/webapp/help.jsp | 40 |
1 files changed, 21 insertions, 19 deletions
diff --git a/BKUOnline/src/main/webapp/help.jsp b/BKUOnline/src/main/webapp/help.jsp index 066ec59e..f557dc02 100644 --- a/BKUOnline/src/main/webapp/help.jsp +++ b/BKUOnline/src/main/webapp/help.jsp @@ -16,35 +16,37 @@ --> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@ page import="java.io.File"%> -<%@ page import="java.util.Locale"%> + <% - StringBuilder path = new StringBuilder("/helpfiles"); + StringBuilder path = new StringBuilder("/helpfiles/"); //servlet mapping assures pathInfo[0] == help //expect pathinfo /help/<languagecode>/<helpfile> String pathInfo[] = (request.getPathInfo() != null) ? request .getPathInfo().split("/") : new String[] {}; if (pathInfo.length < 2) { - path.append("/index.html"); + path.append("index.html"); } else { - String language = "de"; - //System.out.println("locale " + pathInfo[1] + ": " + pathInfo[1].substring(0, 2).toLowerCase()); //new Locale(pathInfo[1]).getLanguage()); - //System.out.println("is dir: " + new File("/helpfiles/de").isDirectory()); - //+ pathInfo[1].substring(0, 2).toLowerCase()).isDirectory()); - if (pathInfo.length > 2 && new File("/helpfiles/" // + new Locale(pathInfo[1]).getLanguage()).isDirectory())) { - + pathInfo[1].substring(0, 2).toLowerCase()).isDirectory()) { - System.out.println("locale " + new Locale(pathInfo[1])); - language = new Locale(pathInfo[1]).getLanguage(); + if (pathInfo.length > 2) { + //new Locale(pathInfo[1]).getLanguage() returns de_at + //anyway, Locale uses _two-letter_ codes as defined by ISO-639 + String language = pathInfo[1].substring(0, 2).toLowerCase(); + if(getServletContext().getResource(path.toString() + language) != null) { + //System.out.println("help available for requested language " + language); + path.append(language); + path.append('/'); + } else { + //System.out.println("no help available for requested language " + language); + path.append("de/"); + } + path.append(pathInfo[2]); + } else { + //System.out.println("no language requested"); + path.append("de/"); + path.append(pathInfo[1]); } - path.append('/'); - path.append(language); - - String filename = pathInfo[(pathInfo.length > 2) ? 2 : 1]; - path.append('/'); - path.append(filename); } - System.out.println(path); + //System.out.println(path); %> <jsp:include page="<%=path.toString()%>" flush="true"/> |