Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
missing file for prev commint "Introduction of additional language setting browser"
reger33bf35d90fde
diff --git a/source/net/yacy/server/http/HTTPDFileHandler.java b/source/net/yacy/server/http/HTTPDFileHandler.javaindex 5aba6243f..0a2fafa99 100644--- a/source/net/yacy/server/http/HTTPDFileHandler.java+++ b/source/net/yacy/server/http/HTTPDFileHandler.java@@ -116,14 +116,29 @@ public final class HTTPDFileHandler {}/** Returns a path to the localized or default file according to the locale.language (from he switchboard)- * @param path relative from htroot */- public static File getLocalizedFile(final String path){- String localeSelection = switchboard.getConfig("locale.language","default");+ * @param path relative from htroot+ * @param clientLang preferred client language (browser setting), applied if config locale.language=browser+ */+ public static File getLocalizedFile(final String path, final String clientLang){+ String localeSelection = switchboard.getConfig("locale.language", "browser");if (!(localeSelection.equals("default"))) {- final File localePath = new File(htLocalePath, localeSelection + '/' + path);- if (localePath.exists()) return localePath; // avoid "NoSuchFile" troubles if the "localeSelection" is misspelled++ if (localeSelection.equals("browser")) { // handle preferred language of client browser+ if (clientLang != null && !clientLang.isEmpty()) {+ final File localePath = new File(htLocalePath, clientLang + '/' + path);+ if (localePath.exists()) { // on success return otherwise continue with default htDocsPath+ return localePath; // avoid "NoSuchFile" troubles if the "localeSelection" is misspelled+ }+ }+ } else { // use language from switchboard config++ final File localePath = new File(htLocalePath, localeSelection + '/' + path);+ if (localePath.exists()) {+ return localePath; // avoid "NoSuchFile" troubles if the "localeSelection" is misspelled+ }+ }}-+final File docsPath = new File(htDocsPath, path);if (docsPath.exists()) return docsPath;return new File(htDefaultPath, path);@@ -131,7 +146,7 @@ public final class HTTPDFileHandler {public static final File getOverlayedFile(final String path) {File targetFile;- targetFile = getLocalizedFile(path);+ targetFile = getLocalizedFile(path, null);if (!targetFile.exists()) {targetFile = new File(htDocsPath, path);}