Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
have Translator servlet adhoc apply added translation by translating a single file + fix NPE in Translator, coming from translation read by TranslatorXliff which allows null content for not translated key's
regere952e355a257
diff --git a/htroot/Translator_p.java b/htroot/Translator_p.javaindex 36b33884a..d46133e0e 100644--- a/htroot/Translator_p.java+++ b/htroot/Translator_p.java@@ -25,6 +25,7 @@ import java.util.Map;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.util.ConcurrentLog;import net.yacy.search.Switchboard;+import net.yacy.search.SwitchboardConstants;import net.yacy.server.serverObjects;import net.yacy.server.serverSwitch;import net.yacy.server.servletProperties;@@ -118,6 +119,15 @@ public class Translator_p {}if (changed) {ctm.saveAsLngFile(langcfg, locallngfile, localTrans);+ // adhoc translate this file+ // 1. get/calc the path+ final String htRootPath = env.getConfig(SwitchboardConstants.HTROOT_PATH, SwitchboardConstants.HTROOT_PATH_DEFAULT);+ final File sourceDir = new File(env.getAppPath(), htRootPath);+ final File destDir = new File(env.getDataPath("locale.translated_html", "DATA/LOCALE/htroot"), locallngfile.getName().substring(0, locallngfile.getName().length() - 4));// cut .lng+ // get absolute file by adding relative filename from translationlist+ final File sourceFile = new File(sourceDir, filename);+ final File destFile = new File(destDir, filename);+ ctm.translateFile(sourceFile, destFile, origTextList); // do the translation}}prop.put("textlist", i);diff --git a/source/net/yacy/data/Translator.java b/source/net/yacy/data/Translator.javaindex 8df94b6c5..ac14a0f7e 100644--- a/source/net/yacy/data/Translator.java+++ b/source/net/yacy/data/Translator.java@@ -82,7 +82,7 @@ public class Translator {if (key != null && !key.isEmpty()) {String translation = entry.getValue();int index = builder.indexOf(key);- if (index < 0) {+ if (index < 0 || translation == null ) {// Filename not available, but it will be printed in Log// after all untranslated Strings as "Translated file: "if (ConcurrentLog.isFine("TRANSLATOR"))