mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
localization Support for Includes
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@923 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
371fd67ecf
commit
7ca60f97bf
|
@ -79,7 +79,7 @@ public class Status {
|
|||
yacyCore.peerActions.updateMySeed();
|
||||
|
||||
if (((plasmaSwitchboard) env).adminAuthenticated(header) >= 2) {
|
||||
prop.put("privateStatusTable", new File(env.getRootPath(), "htroot/Status_p.inc").toString());
|
||||
prop.put("privateStatusTable", "Status_p.inc");
|
||||
} else {
|
||||
prop.put("privateStatusTable", "");
|
||||
}
|
||||
|
|
|
@ -373,7 +373,8 @@ public final class httpTemplate {
|
|||
if ((!filename.equals("")) && (!filename.equals(dflt))) {
|
||||
BufferedReader br = null;
|
||||
try{
|
||||
br = new BufferedReader(new InputStreamReader(new FileInputStream( filename )));
|
||||
//br = new BufferedReader(new InputStreamReader(new FileInputStream( filename ))); //Simple Include
|
||||
br = new BufferedReader( new InputStreamReader(new FileInputStream( httpdFileHandler.getLocalizedFile(filename) )) ); //YaCy (with Locales)
|
||||
//Read the Include
|
||||
while( (line = br.readLine()) != null ){
|
||||
include+=line+de.anomic.server.serverCore.crlfString;
|
||||
|
|
|
@ -212,6 +212,28 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
|
|||
serverLog.logWarning("HTTPDFileHandler", "Content-MD5 support not availabel ...");
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Returns the path of a (existing) localized File, or the english one, if not availible.
|
||||
* @param path is relative from htroot
|
||||
* @return the function returns a Filehandle to the translated file, or if not availitble to the english one.
|
||||
*/
|
||||
public static File getLocalizedFile(String path){
|
||||
plasmaSwitchboard switchboard=plasmaSwitchboard.getSwitchboard();
|
||||
// create htLocaleDefault, htLocalePath
|
||||
if (htDefaultPath == null) htDefaultPath = new File(switchboard.getRootPath(), switchboard.getConfig("htDefaultPath","htroot"));
|
||||
if (htLocalePath == null) htLocalePath = new File(switchboard.getRootPath(), switchboard.getConfig("htLocalePath","htroot/locale"));
|
||||
//htLocaleSelection = switchboard.getConfig("htLocaleSelection","default");
|
||||
|
||||
// find locales or alternatives in htDocsPath
|
||||
String htLocaleSelection = switchboard.getConfig("htLocaleSelection","default");
|
||||
// look if we have a localization of that file
|
||||
if (!(htLocaleSelection.equals("default"))) {
|
||||
File localePath = new File(htLocalePath, htLocaleSelection + "/" + path);
|
||||
if (localePath.exists())
|
||||
return localePath;
|
||||
}
|
||||
return new File(htDefaultPath, path);
|
||||
}
|
||||
|
||||
// private void textMessage(OutputStream out, int retcode, String body) throws IOException {
|
||||
// httpd.sendRespondHeader(
|
||||
|
@ -455,13 +477,7 @@ public final class httpdFileHandler extends httpdAbstractHandler implements http
|
|||
path.endsWith("csv") ||
|
||||
path.endsWith("pac")) {
|
||||
|
||||
// find locales or alternatives in htDocsPath
|
||||
String htLocaleSelection = switchboard.getConfig("htLocaleSelection","default");
|
||||
// look if we have a localization of that file
|
||||
if (!(htLocaleSelection.equals("default"))) {
|
||||
File localePath = new File(htLocalePath, htLocaleSelection + "/" + path);
|
||||
if (localePath.exists()) targetFile = localePath;
|
||||
}
|
||||
targetFile = getLocalizedFile(path);
|
||||
|
||||
// call rewrite-class
|
||||
serverObjects tp = new serverObjects();
|
||||
|
|
Loading…
Reference in New Issue
Block a user