diff --git a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java index 03f567f134d7268b3ee80ff1eccd416951670d90..3d11191a971ceb7b62cd3380b72c7a4efe83cb81 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/PluginStarter.java @@ -17,6 +17,7 @@ import net.i2p.router.RouterContext; import net.i2p.router.startup.ClientAppConfig; import net.i2p.router.startup.LoadClientAppsJob; import net.i2p.util.Log; +import net.i2p.util.Translate; import org.mortbay.http.HttpListener; import org.mortbay.jetty.Server; @@ -103,6 +104,29 @@ public class PluginStarter implements Runnable { } // add translation jars in console/locale + // These will not override existing resource bundles since we are adding them + // later in the classpath. + File localeDir = new File(pluginDir, "console/locale"); + if (localeDir.exists() && localeDir.isDirectory()) { + File[] files = localeDir.listFiles(); + if (files != null) { + boolean added = false; + for (int i = 0; i < files.length; i++) { + File f = files[i]; + if (f.getName().endsWith(".jar")) { + try { + addPath(f.toURI().toURL()); + log.error("INFO: Adding translation plugin to classpath: " + f); + added = true; + } catch (Exception e) { + log.error("Plugin " + appName + " bad classpath element: " + f, e); + } + } + } + if (added) + Translate.clearCache(); + } + } // add themes in console/themes @@ -196,8 +220,8 @@ public class PluginStarter implements Runnable { continue; } try { - log.error("INFO: Adding plugin classpath: " + f); addPath(f.toURI().toURL()); + log.error("INFO: Adding plugin to classpath: " + f); } catch (Exception e) { log.error("Plugin client " + clientName + " bad classpath element: " + f, e); } diff --git a/core/java/src/net/i2p/util/Translate.java b/core/java/src/net/i2p/util/Translate.java index c9072b62f5f7e79ff1c0db8ad5c029254f19cb97..799b89c00cc2e0b5e0c5af4f22cfc7e21a93f4fb 100644 --- a/core/java/src/net/i2p/util/Translate.java +++ b/core/java/src/net/i2p/util/Translate.java @@ -126,4 +126,13 @@ public abstract class Translate { } return rv; } + + /** + * Clear the cache. + * Call this after adding new bundles to the classpath. + * @since 0.7.12 + */ + public static void clearCache() { + _missing.clear(); + } }