From 44e7ad81fdc87e81017d02e803e907008757a822 Mon Sep 17 00:00:00 2001 From: clemenso Date: Thu, 9 Jul 2009 14:07:51 +0000 Subject: temp git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@404 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- BKUOnline/src/main/webapp/help.jsp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'BKUOnline/src/main/webapp') diff --git a/BKUOnline/src/main/webapp/help.jsp b/BKUOnline/src/main/webapp/help.jsp index 1d0c6f73..066ec59e 100644 --- a/BKUOnline/src/main/webapp/help.jsp +++ b/BKUOnline/src/main/webapp/help.jsp @@ -17,26 +17,31 @@ <%@ 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// 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"; - if (pathInfo.length > 2 && (new File("/helpfiles/" + - pathInfo[1].split("_")[0].toLowerCase())).isDirectory()) { - language = pathInfo[1].split("_")[0]; + //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(); } - path.append(language); path.append('/'); + path.append(language); String filename = pathInfo[(pathInfo.length > 2) ? 2 : 1]; + path.append('/'); path.append(filename); } System.out.println(path); -- cgit v1.2.3