forked from I2P_Developers/i2p.i2p
Rename _() for translation to _t() for Java 9 compatibility (ticket #1456)
This commit is contained in:
@@ -43,7 +43,7 @@ then
|
||||
mkdir -p build
|
||||
echo '// Automatically generated pseudo-java for xgettext - do not edit' > $JFILE
|
||||
echo '// Translators may wish to translate a few of these, do not bother to translate all of them!!' >> $JFILE
|
||||
sed -e '/^#/d' -e 's/..,\(..*\)/_("\1");/' $CFILE >> $JFILE
|
||||
sed -e '/^#/d' -e 's/..,\(..*\)/_t("\1");/' $CFILE >> $JFILE
|
||||
fi
|
||||
|
||||
# add ../java/ so the refs will work in the po file
|
||||
@@ -76,16 +76,16 @@ do
|
||||
echo "Updating the $i file from the tags..."
|
||||
# extract strings from java and jsp files, and update messages.po files
|
||||
# translate calls must be one of the forms:
|
||||
# _("foo")
|
||||
# _t("foo")
|
||||
# _x("foo")
|
||||
# intl._("foo")
|
||||
# intl._t("foo")
|
||||
# intl.title("foo")
|
||||
# In a jsp, you must use a helper or handler that has the context set.
|
||||
# To start a new translation, copy the header from an old translation to the new .po file,
|
||||
# then ant distclean updater.
|
||||
find $JPATHS -name *.java > $TMPFILE
|
||||
xgettext -f $TMPFILE -L java --from-code=UTF-8 --no-location\
|
||||
--keyword=_ \
|
||||
--keyword=_t \
|
||||
-o ${i}t
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
|
||||
@@ -62,16 +62,16 @@ do
|
||||
echo "Updating the $i file from the tags..."
|
||||
# extract strings from java and jsp files, and update messages.po files
|
||||
# translate calls must be one of the forms:
|
||||
# _("foo")
|
||||
# _t("foo")
|
||||
# _x("foo")
|
||||
# intl._("foo")
|
||||
# intl._t("foo")
|
||||
# intl.title("foo")
|
||||
# In a jsp, you must use a helper or handler that has the context set.
|
||||
# To start a new translation, copy the header from an old translation to the new .po file,
|
||||
# then ant distclean updater.
|
||||
find $JPATHS -name *.java > $TMPFILE
|
||||
xgettext -f $TMPFILE -L java --from-code=UTF-8 --no-location\
|
||||
--keyword=_ \
|
||||
--keyword=_t \
|
||||
-o ${i}t
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
|
||||
@@ -84,19 +84,19 @@ do
|
||||
echo "Updating the $i file from the tags..."
|
||||
# extract strings from java and jsp files, and update messages.po files
|
||||
# translate calls must be one of the forms:
|
||||
# _("foo")
|
||||
# _t("foo")
|
||||
# _x("foo")
|
||||
# intl._("foo")
|
||||
# intl._t("foo")
|
||||
# intl.title("foo")
|
||||
# handler._("foo")
|
||||
# formhandler._("foo")
|
||||
# handler._t("foo")
|
||||
# formhandler._t("foo")
|
||||
# net.i2p.router.web.Messages.getString("foo")
|
||||
# In a jsp, you must use a helper or handler that has the context set.
|
||||
# To start a new translation, copy the header from an old translation to the new .po file,
|
||||
# then ant distclean updater.
|
||||
find $JPATHS -name *.java > $TMPFILE
|
||||
xgettext -f $TMPFILE -F -L java --from-code=UTF-8 --add-comments\
|
||||
--keyword=_ --keyword=_x --keyword=intl._ --keyword=intl.title \
|
||||
--keyword=_t --keyword=_x --keyword=intl._ --keyword=intl.title \
|
||||
--keyword=handler._ --keyword=formhandler._ \
|
||||
--keyword=net.i2p.router.web.Messages.getString \
|
||||
-o ${i}t
|
||||
|
||||
@@ -881,7 +881,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
break;
|
||||
|
||||
case PLUGIN:
|
||||
msg = "<b>" + _("New plugin version {0} is available", newVersion) + "</b>";
|
||||
msg = "<b>" + _t("New plugin version {0} is available", newVersion) + "</b>";
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -961,11 +961,11 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
|
||||
case PLUGIN:
|
||||
if (!success) {
|
||||
msg = _("Update check failed for plugin {0}", task.getID());
|
||||
msg = _t("Update check failed for plugin {0}", task.getID());
|
||||
_log.logAlways(Log.WARN, msg);
|
||||
msg = "<b>" + msg + "</b>";
|
||||
} else if (!newer) {
|
||||
msg = "<b>" + _("No new version is available for plugin {0}", task.getID()) + "</b>";
|
||||
msg = "<b>" + _t("No new version is available for plugin {0}", task.getID()) + "</b>";
|
||||
}
|
||||
/// else success.... message for that?
|
||||
|
||||
@@ -989,7 +989,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
buf.append(_pct.format(pct));
|
||||
}
|
||||
buf.append("<br>\n");
|
||||
buf.append(_("{0}B transferred", DataHelper.formatSize2(downloaded)));
|
||||
buf.append(_t("{0}B transferred", DataHelper.formatSize2(downloaded)));
|
||||
updateStatus(buf.toString());
|
||||
}
|
||||
|
||||
@@ -1048,9 +1048,9 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
String uri = task.getURI().toString();
|
||||
if (uri.startsWith("file:") || task.getMethod() == FILE) {
|
||||
uri = DataHelper.stripHTML(task.getURI().getPath());
|
||||
buf.append(_("Install failed from {0}", uri));
|
||||
buf.append(_t("Install failed from {0}", uri));
|
||||
} else {
|
||||
buf.append(_("Transfer failed from {0}", uri));
|
||||
buf.append(_t("Transfer failed from {0}", uri));
|
||||
}
|
||||
if (reason != null && reason.length() > 0) {
|
||||
buf.append("<br>");
|
||||
@@ -1325,7 +1325,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
*/
|
||||
private boolean handleRouterFile(URI uri, String actualVersion, File f, boolean isSU3) {
|
||||
String url = uri.toString();
|
||||
updateStatus("<b>" + _("Update downloaded") + "</b>");
|
||||
updateStatus("<b>" + _t("Update downloaded") + "</b>");
|
||||
File to = new File(_context.getRouterDir(), Router.UPDATE_FILE);
|
||||
String err;
|
||||
// Process the file
|
||||
@@ -1369,7 +1369,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
|
||||
if ("install".equals(policy)) {
|
||||
_log.log(Log.CRIT, "Update was downloaded and verified, restarting to install it");
|
||||
updateStatus("<b>" + _("Update verified") + "</b><br>" + _("Restarting"));
|
||||
updateStatus("<b>" + _t("Update verified") + "</b><br>" + _t("Restarting"));
|
||||
restart();
|
||||
} else {
|
||||
_log.logAlways(Log.WARN, "Update was downloaded and verified, will be installed at next restart");
|
||||
@@ -1378,7 +1378,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
}
|
||||
} else {
|
||||
_log.log(Log.CRIT, err + " from " + url);
|
||||
updateStatus("<b>" + err + ' ' + _("from {0}", linkify(url)) + " </b>");
|
||||
updateStatus("<b>" + err + ' ' + _t("from {0}", linkify(url)) + " </b>");
|
||||
}
|
||||
return err == null;
|
||||
}
|
||||
@@ -1389,11 +1389,11 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
*/
|
||||
private boolean handleUnsignedFile(URI uri, String lastmod, File updFile) {
|
||||
if (FileUtil.verifyZip(updFile)) {
|
||||
updateStatus("<b>" + _("Update downloaded") + "</b>");
|
||||
updateStatus("<b>" + _t("Update downloaded") + "</b>");
|
||||
} else {
|
||||
updFile.delete();
|
||||
String url = uri.toString();
|
||||
updateStatus("<b>" + _("Unsigned update file from {0} is corrupt", url) + "</b>");
|
||||
updateStatus("<b>" + _t("Unsigned update file from {0} is corrupt", url) + "</b>");
|
||||
_log.log(Log.CRIT, "Corrupt zip file from " + url);
|
||||
return false;
|
||||
}
|
||||
@@ -1413,7 +1413,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
_context.router().saveConfig(NewsHelper.PROP_LAST_UPDATE_TIME, Long.toString(modtime));
|
||||
if ("install".equals(policy)) {
|
||||
_log.log(Log.CRIT, "Update was downloaded, restarting to install it");
|
||||
updateStatus("<b>" + _("Update downloaded") + "</b><br>" + _("Restarting"));
|
||||
updateStatus("<b>" + _t("Update downloaded") + "</b><br>" + _t("Restarting"));
|
||||
restart();
|
||||
} else {
|
||||
_log.logAlways(Log.WARN, "Update was downloaded, will be installed at next restart");
|
||||
@@ -1422,7 +1422,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
}
|
||||
} else {
|
||||
_log.log(Log.CRIT, "Failed copy to " + to);
|
||||
updateStatus("<b>" + _("Failed copy to {0}", to.getAbsolutePath()) + "</b>");
|
||||
updateStatus("<b>" + _t("Failed copy to {0}", to.getAbsolutePath()) + "</b>");
|
||||
}
|
||||
return copied;
|
||||
}
|
||||
@@ -1453,14 +1453,14 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
public String _(String s) {
|
||||
public String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
/**
|
||||
* translate a string with a parameter
|
||||
*/
|
||||
public String _(String s, Object o) {
|
||||
public String _t(String s, Object o) {
|
||||
return Messages.getString(s, o, _context);
|
||||
}
|
||||
|
||||
@@ -1468,7 +1468,7 @@ public class ConsoleUpdateManager implements UpdateManager, RouterApp {
|
||||
* translate a string with parameters
|
||||
* @since 0.9.9
|
||||
*/
|
||||
public String _(String s, Object o, Object o2) {
|
||||
public String _t(String s, Object o, Object o2) {
|
||||
return Messages.getString(s, o, o2, _context);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,14 +44,14 @@ class DevSU3UpdateChecker extends UpdateRunner {
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
String msg = _t("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
_mgr.notifyCheckComplete(this, false, false);
|
||||
return;
|
||||
}
|
||||
//updateStatus("<b>" + _("Checking for development build update") + "</b>");
|
||||
//updateStatus("<b>" + _t("Checking for development build update") + "</b>");
|
||||
_baos.reset();
|
||||
try {
|
||||
_get = new PartialEepGet(_context, proxyHost, proxyPort, _baos, _currentURI.toString(), TrustedUpdate.HEADER_BYTES);
|
||||
@@ -76,7 +76,7 @@ class DevSU3UpdateChecker extends UpdateRunner {
|
||||
_mgr.notifyVersionAvailable(this, _currentURI, UpdateType.ROUTER_DEV_SU3, "", UpdateMethod.HTTP,
|
||||
_urls, newVersion, RouterVersion.FULL_VERSION);
|
||||
} else {
|
||||
//updateStatus("<b>" + _("No new version found at {0}", linkify(url)) + "</b>");
|
||||
//updateStatus("<b>" + _t("No new version found at {0}", linkify(url)) + "</b>");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn("Found old version \"" + newVersion + "\" at " + url);
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ class DevSU3UpdateHandler implements Checker, Updater {
|
||||
return null;
|
||||
UpdateRunner update = new DevSU3UpdateRunner(_context, _mgr, updateSources);
|
||||
// set status before thread to ensure UI feedback
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + "</b>");
|
||||
return update;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ class DevSU3UpdateRunner extends UpdateRunner {
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
String msg = _t("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
|
||||
@@ -215,13 +215,13 @@ class NewsFetcher extends UpdateRunner {
|
||||
_log.debug("Found version: [" + ver + "]");
|
||||
if (TrustedUpdate.needsUpdate(RouterVersion.VERSION, ver)) {
|
||||
if (NewsHelper.isUpdateDisabled(_context)) {
|
||||
String msg = _mgr._("In-network updates disabled. Check package manager.");
|
||||
String msg = _mgr._t("In-network updates disabled. Check package manager.");
|
||||
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
|
||||
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
|
||||
return;
|
||||
}
|
||||
if (NewsHelper.isBaseReadonly(_context)) {
|
||||
String msg = _mgr._("No write permission for I2P install directory.");
|
||||
String msg = _mgr._t("No write permission for I2P install directory.");
|
||||
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
|
||||
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
|
||||
return;
|
||||
@@ -229,7 +229,7 @@ class NewsFetcher extends UpdateRunner {
|
||||
String minRouter = args.get(MIN_VERSION_KEY);
|
||||
if (minRouter != null) {
|
||||
if (VersionComparator.comp(RouterVersion.VERSION, minRouter) < 0) {
|
||||
String msg = _mgr._("You must first update to version {0}", minRouter);
|
||||
String msg = _mgr._t("You must first update to version {0}", minRouter);
|
||||
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
|
||||
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
|
||||
return;
|
||||
@@ -239,7 +239,7 @@ class NewsFetcher extends UpdateRunner {
|
||||
if (minJava != null) {
|
||||
String ourJava = System.getProperty("java.version");
|
||||
if (VersionComparator.comp(ourJava, minJava) < 0) {
|
||||
String msg = _mgr._("Requires Java version {0} but installed Java version is {1}", minJava, ourJava);
|
||||
String msg = _mgr._t("Requires Java version {0} but installed Java version is {1}", minJava, ourJava);
|
||||
_log.logAlways(Log.WARN, "Cannot update to version " + ver + ": " + msg);
|
||||
_mgr.notifyVersionConstraint(this, _currentURI, ROUTER_SIGNED, "", ver, msg);
|
||||
return;
|
||||
|
||||
@@ -52,14 +52,14 @@ class PluginUpdateChecker extends UpdateRunner {
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
String msg = _t("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
_mgr.notifyCheckComplete(this, false, false);
|
||||
return;
|
||||
}
|
||||
updateStatus("<b>" + _("Checking for update of plugin {0}", _appName) + "</b>");
|
||||
updateStatus("<b>" + _t("Checking for update of plugin {0}", _appName) + "</b>");
|
||||
_baos.reset();
|
||||
try {
|
||||
_get = new PartialEepGet(_context, proxyHost, proxyPort, _baos, _currentURI.toString(), TrustedUpdate.HEADER_BYTES);
|
||||
|
||||
@@ -54,7 +54,7 @@ class PluginUpdateHandler implements Checker, Updater {
|
||||
}
|
||||
|
||||
if (oldVersion == null || updateSources == null) {
|
||||
//updateStatus("<b>" + _("Cannot check, plugin {0} is not installed", appName) + "</b>");
|
||||
//updateStatus("<b>" + _t("Cannot check, plugin {0} is not installed", appName) + "</b>");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class PluginUpdateHandler implements Checker, Updater {
|
||||
|
||||
UpdateRunner update = new PluginUpdateRunner(_context, _mgr, updateSources, appName, oldVersion);
|
||||
// set status before thread to ensure UI feedback
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + "</b>");
|
||||
return update;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,15 +87,15 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
// strip off file:// or just file:
|
||||
String xpi2pfile = _uri.getPath();
|
||||
if(xpi2pfile == null || xpi2pfile.length() == 0) {
|
||||
statusDone("<b>" + _("Bad URL {0}", _xpi2pURL) + "</b>");
|
||||
statusDone("<b>" + _t("Bad URL {0}", _xpi2pURL) + "</b>");
|
||||
} else {
|
||||
// copy the contents of from to _updateFile
|
||||
long alreadyTransferred = (new File(xpi2pfile)).getAbsoluteFile().length();
|
||||
if(FileUtil.copy((new File(xpi2pfile)).getAbsolutePath(), _updateFile, true, false)) {
|
||||
updateStatus("<b>" + _("Attempting to install from file {0}", _xpi2pURL) + "</b>");
|
||||
updateStatus("<b>" + _t("Attempting to install from file {0}", _xpi2pURL) + "</b>");
|
||||
transferComplete(alreadyTransferred, alreadyTransferred, 0L, _xpi2pURL, _updateFile, false);
|
||||
} else {
|
||||
statusDone("<b>" + _("Failed to install from file {0}, copy failed.", _xpi2pURL) + "</b>");
|
||||
statusDone("<b>" + _t("Failed to install from file {0}, copy failed.", _xpi2pURL) + "</b>");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -108,14 +108,14 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
if (shouldProxy && proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
String msg = _t("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
statusDone("<b>" + msg + "</b>");
|
||||
_mgr.notifyTaskFailed(this, msg, null);
|
||||
return;
|
||||
}
|
||||
updateStatus("<b>" + _("Downloading plugin from {0}", _xpi2pURL) + "</b>");
|
||||
updateStatus("<b>" + _t("Downloading plugin from {0}", _xpi2pURL) + "</b>");
|
||||
try {
|
||||
if (shouldProxy)
|
||||
// 10 retries!!
|
||||
@@ -136,12 +136,12 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
|
||||
@Override
|
||||
public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile, boolean notModified) {
|
||||
updateStatus("<b>" + _("Plugin downloaded") + "</b>");
|
||||
updateStatus("<b>" + _t("Plugin downloaded") + "</b>");
|
||||
File f = new File(_updateFile);
|
||||
File appDir = new SecureDirectory(_context.getConfigDir(), PLUGIN_DIR);
|
||||
if ((!appDir.exists()) && (!appDir.mkdir())) {
|
||||
f.delete();
|
||||
statusDone("<b>" + _("Cannot create plugin directory {0}", appDir.getAbsolutePath()) + "</b>");
|
||||
statusDone("<b>" + _t("Cannot create plugin directory {0}", appDir.getAbsolutePath()) + "</b>");
|
||||
return;
|
||||
}
|
||||
boolean isSU3;
|
||||
@@ -186,7 +186,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
// extract to a zip file whether the sig is good or not, so we can get the properties file
|
||||
String err = up.migrateFile(f, to);
|
||||
if (err != null) {
|
||||
statusDone("<b>" + err + ' ' + _("from {0}", url) + " </b>");
|
||||
statusDone("<b>" + err + ' ' + _t("from {0}", url) + " </b>");
|
||||
f.delete();
|
||||
to.delete();
|
||||
return;
|
||||
@@ -202,7 +202,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
f.delete();
|
||||
to.delete();
|
||||
//updateStatus("<b>" + "Plugin contains an invalid key" + ' ' + pubkey + ' ' + signer + "</b>");
|
||||
statusDone("<b>" + _("Plugin from {0} contains an invalid key", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin from {0} contains an invalid key", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
SigningPublicKey spk;
|
||||
@@ -211,7 +211,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
} catch (DataFormatException dfe) {
|
||||
f.delete();
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin from {0} contains an invalid key", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin from {0} contains an invalid key", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
_log.error("Failed to verify plugin signature, corrupt plugin or bad signature, signed by: " + signer);
|
||||
else
|
||||
_log.error("Plugin signer \"" + signer + "\" does not match existing signer in plugin.config file \"" + signingKeyName + "\"");
|
||||
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin signature verification of {0} failed", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
} else if (_context.getBooleanProperty(PROP_ALLOW_NEW_KEYS)) {
|
||||
@@ -254,7 +254,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
f.delete();
|
||||
to.delete();
|
||||
_log.error("Bad key or key mismatch - Failed to add plugin key \"" + pubkey + "\" for plugin signer \"" + signer + "\"");
|
||||
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin signature verification of {0} failed", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
// ...and try the verify again
|
||||
@@ -268,7 +268,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
else
|
||||
// shouldn't happen
|
||||
_log.error("Plugin signer \"" + signer + "\" does not match new signer in plugin.config file \"" + signingKeyName + "\"");
|
||||
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin signature verification of {0} failed", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
@@ -277,7 +277,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
to.delete();
|
||||
_log.error("Untrusted plugin key \"" + pubkey + "\" for plugin signer \"" + signer + "\"");
|
||||
// don't display signer, we're really checking the key not the signer name
|
||||
statusDone("<b>" + _("Plugin not installed - signer is untrusted") + "</b>");
|
||||
statusDone("<b>" + _t("Plugin not installed - signer is untrusted") + "</b>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
sudVersion = su3.getVersionString();
|
||||
signingKeyName = su3.getSignerString();
|
||||
} catch (IOException ioe) {
|
||||
statusDone("<b>" + ioe + ' ' + _("from {0}", url) + " </b>");
|
||||
statusDone("<b>" + ioe + ' ' + _t("from {0}", url) + " </b>");
|
||||
f.delete();
|
||||
to.delete();
|
||||
return;
|
||||
@@ -315,7 +315,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
if (signer == null || signer.length() <= 0) {
|
||||
f.delete();
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin from {0} contains an invalid key", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin from {0} contains an invalid key", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
if (!signer.equals(signingKeyName)) {
|
||||
@@ -326,7 +326,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
else
|
||||
// shouldn't happen
|
||||
_log.error("Plugin signer \"" + signer + "\" does not match new signer in plugin.config file \"" + signingKeyName + "\"");
|
||||
statusDone("<b>" + _("Plugin signature verification of {0} failed", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin signature verification of {0} failed", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
processFinal(to, appDir, url, props, sudVersion, null, signer);
|
||||
@@ -342,7 +342,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
f.delete();
|
||||
to.delete();
|
||||
FileUtil.rmdir(tempDir, false);
|
||||
statusDone("<b>" + _("Plugin from {0} is corrupt", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin from {0} is corrupt", url) + "</b>");
|
||||
return null;
|
||||
}
|
||||
File installProps = new File(tempDir, "plugin.config");
|
||||
@@ -352,7 +352,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
} catch (IOException ioe) {
|
||||
f.delete();
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin from {0} does not contain the required configuration file", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin from {0} does not contain the required configuration file", url) + "</b>");
|
||||
return null;
|
||||
} finally {
|
||||
// we don't need this anymore, we will unzip again
|
||||
@@ -374,12 +374,12 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
version.indexOf("<") >= 0 || version.indexOf(">") >= 0 ||
|
||||
appName.startsWith(".") || appName.indexOf("/") >= 0 || appName.indexOf("\\") >= 0) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin from {0} has invalid name or version", url) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin from {0} has invalid name or version", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
if (!version.equals(sudVersion)) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin {0} has mismatched versions", appName) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin {0} has mismatched versions", appName) + "</b>");
|
||||
return;
|
||||
}
|
||||
// set so notifyComplete() will work
|
||||
@@ -390,7 +390,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
if (minVersion != null &&
|
||||
VersionComparator.comp(CoreVersion.VERSION, minVersion) < 0) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("This plugin requires I2P version {0} or higher", minVersion) + "</b>");
|
||||
statusDone("<b>" + _t("This plugin requires I2P version {0} or higher", minVersion) + "</b>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -398,7 +398,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
if (minVersion != null &&
|
||||
VersionComparator.comp(System.getProperty("java.version"), minVersion) < 0) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("This plugin requires Java version {0} or higher", minVersion) + "</b>");
|
||||
statusDone("<b>" + _t("This plugin requires Java version {0} or higher", minVersion) + "</b>");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -407,7 +407,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
if (destDir.exists()) {
|
||||
if (Boolean.valueOf(props.getProperty("install-only")).booleanValue()) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Downloaded plugin is for new installs only, but the plugin is already installed", url) + "</b>");
|
||||
statusDone("<b>" + _t("Downloaded plugin is for new installs only, but the plugin is already installed", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
// compare previous version
|
||||
@@ -417,7 +417,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
DataHelper.loadProps(oldProps, oldPropFile);
|
||||
} catch (IOException ioe) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Installed plugin does not contain the required configuration file", url) + "</b>");
|
||||
statusDone("<b>" + _t("Installed plugin does not contain the required configuration file", url) + "</b>");
|
||||
return;
|
||||
}
|
||||
String oldPubkey = oldProps.getProperty("key");
|
||||
@@ -425,28 +425,28 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
String oldAppName = oldProps.getProperty("name");
|
||||
if ((pubkey != null && !pubkey.equals(oldPubkey)) || (!signer.equals(oldKeyName)) || (!appName.equals(oldAppName))) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Signature of downloaded plugin does not match installed plugin") + "</b>");
|
||||
statusDone("<b>" + _t("Signature of downloaded plugin does not match installed plugin") + "</b>");
|
||||
return;
|
||||
}
|
||||
String oldVersion = oldProps.getProperty("version");
|
||||
if (oldVersion == null ||
|
||||
VersionComparator.comp(oldVersion, version) >= 0) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Downloaded plugin version {0} is not newer than installed plugin", version) + "</b>");
|
||||
statusDone("<b>" + _t("Downloaded plugin version {0} is not newer than installed plugin", version) + "</b>");
|
||||
return;
|
||||
}
|
||||
minVersion = ConfigClientsHelper.stripHTML(props, "min-installed-version");
|
||||
if (minVersion != null &&
|
||||
VersionComparator.comp(minVersion, oldVersion) > 0) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin update requires installed plugin version {0} or higher", minVersion) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin update requires installed plugin version {0} or higher", minVersion) + "</b>");
|
||||
return;
|
||||
}
|
||||
String maxVersion = ConfigClientsHelper.stripHTML(props, "max-installed-version");
|
||||
if (maxVersion != null &&
|
||||
VersionComparator.comp(maxVersion, oldVersion) < 0) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin update requires installed plugin version {0} or lower", maxVersion) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin update requires installed plugin version {0} or lower", maxVersion) + "</b>");
|
||||
return;
|
||||
}
|
||||
oldVersion = LogsHelper.jettyVersion();
|
||||
@@ -454,14 +454,14 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
if (minVersion != null &&
|
||||
VersionComparator.comp(minVersion, oldVersion) > 0) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin requires Jetty version {0} or higher", minVersion) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin requires Jetty version {0} or higher", minVersion) + "</b>");
|
||||
return;
|
||||
}
|
||||
maxVersion = ConfigClientsHelper.stripHTML(props, "max-jetty-version");
|
||||
if (maxVersion != null &&
|
||||
VersionComparator.comp(maxVersion, oldVersion) < 0) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin requires Jetty version {0} or lower", maxVersion) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin requires Jetty version {0} or lower", maxVersion) + "</b>");
|
||||
return;
|
||||
}
|
||||
// do we defer extraction and installation?
|
||||
@@ -470,7 +470,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
try {
|
||||
if(!FileUtil.copy(to, (new SecureFile( new SecureFile(appDir.getCanonicalPath() +"/" + appName +"/"+ ZIP).getCanonicalPath())) , true, true)) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Cannot copy plugin to directory {0}", destDir.getAbsolutePath()) + "</b>");
|
||||
statusDone("<b>" + _t("Cannot copy plugin to directory {0}", destDir.getAbsolutePath()) + "</b>");
|
||||
return;
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
@@ -480,7 +480,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
}
|
||||
// we don't need the original file anymore.
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin will be installed on next restart.") + "</b>");
|
||||
statusDone("<b>" + _t("Plugin will be installed on next restart.") + "</b>");
|
||||
return;
|
||||
}
|
||||
if (PluginStarter.isPluginRunning(appName, _context)) {
|
||||
@@ -498,12 +498,12 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
} else {
|
||||
if (Boolean.valueOf(props.getProperty("update-only")).booleanValue()) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Plugin is for upgrades only, but the plugin is not installed") + "</b>");
|
||||
statusDone("<b>" + _t("Plugin is for upgrades only, but the plugin is not installed") + "</b>");
|
||||
return;
|
||||
}
|
||||
if (!destDir.mkdir()) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Cannot create plugin directory {0}", destDir.getAbsolutePath()) + "</b>");
|
||||
statusDone("<b>" + _t("Cannot create plugin directory {0}", destDir.getAbsolutePath()) + "</b>");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -511,14 +511,14 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
// Finally, extract the zip to the plugin directory
|
||||
if (!FileUtil.extractZip(to, destDir, Log.WARN)) {
|
||||
to.delete();
|
||||
statusDone("<b>" + _("Failed to install plugin in {0}", destDir.getAbsolutePath()) + "</b>");
|
||||
statusDone("<b>" + _t("Failed to install plugin in {0}", destDir.getAbsolutePath()) + "</b>");
|
||||
return;
|
||||
}
|
||||
_updated = true;
|
||||
to.delete();
|
||||
// install != update. Changing the user's settings like this is probabbly a bad idea.
|
||||
if (Boolean.valueOf( props.getProperty("dont-start-at-install")).booleanValue()) {
|
||||
statusDone("<b>" + _("Plugin {0} installed", appName) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin {0} installed", appName) + "</b>");
|
||||
if(!update) {
|
||||
Properties pluginProps = PluginStarter.pluginProperties();
|
||||
pluginProps.setProperty(PluginStarter.PREFIX + appName + PluginStarter.ENABLED, "false");
|
||||
@@ -537,16 +537,16 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
link = "<a target=\"_blank\" href=\"" + linkURL + "\"/>" + linkName + "</a>";
|
||||
else
|
||||
link = appName;
|
||||
statusDone("<b>" + _("Plugin {0} installed and started", link) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin {0} installed and started", link) + "</b>");
|
||||
}
|
||||
else
|
||||
statusDone("<b>" + _("Plugin {0} installed but failed to start, check logs", appName) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin {0} installed but failed to start, check logs", appName) + "</b>");
|
||||
} catch (Throwable e) {
|
||||
statusDone("<b>" + _("Plugin {0} installed but failed to start", appName) + ": " + e + "</b>");
|
||||
statusDone("<b>" + _t("Plugin {0} installed but failed to start", appName) + ": " + e + "</b>");
|
||||
_log.error("Error starting plugin " + appName, e);
|
||||
}
|
||||
} else {
|
||||
statusDone("<b>" + _("Plugin {0} installed", appName) + "</b>");
|
||||
statusDone("<b>" + _t("Plugin {0} installed", appName) + "</b>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -554,7 +554,7 @@ class PluginUpdateRunner extends UpdateRunner {
|
||||
public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) {
|
||||
File f = new File(_updateFile);
|
||||
f.delete();
|
||||
statusDone("<b>" + _("Failed to download plugin from {0}", url) + "</b>");
|
||||
statusDone("<b>" + _t("Failed to download plugin from {0}", url) + "</b>");
|
||||
}
|
||||
|
||||
private void statusDone(String msg) {
|
||||
|
||||
@@ -59,14 +59,14 @@ class UnsignedUpdateChecker extends UpdateRunner {
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
String msg = _t("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
return false;
|
||||
}
|
||||
|
||||
//updateStatus("<b>" + _("Checking for development build update") + "</b>");
|
||||
//updateStatus("<b>" + _t("Checking for development build update") + "</b>");
|
||||
try {
|
||||
EepHead get = new EepHead(_context, proxyHost, proxyPort, 0, url);
|
||||
if (get.fetch()) {
|
||||
|
||||
@@ -88,7 +88,7 @@ class UnsignedUpdateHandler implements Checker, Updater {
|
||||
return null;
|
||||
UpdateRunner update = new UnsignedUpdateRunner(_context, _mgr, updateSources);
|
||||
// set status before thread to ensure UI feedback
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + "</b>");
|
||||
return update;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ class UnsignedUpdateRunner extends UpdateRunner {
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
String msg = _t("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
|
||||
@@ -49,7 +49,7 @@ class UpdateHandler implements Updater {
|
||||
return null;
|
||||
UpdateRunner update = new UpdateRunner(_context, _mgr, type, method, updateSources);
|
||||
// set status before thread to ensure UI feedback
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._("Updating") + "</b>");
|
||||
_mgr.notifyProgress(update, "<b>" + _mgr._t("Updating") + "</b>");
|
||||
return update;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
|
||||
if (proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
String msg = _("HTTP client proxy tunnel must be running");
|
||||
String msg = _t("HTTP client proxy tunnel must be running");
|
||||
if (_log.shouldWarn())
|
||||
_log.warn(msg);
|
||||
updateStatus("<b>" + msg + "</b>");
|
||||
@@ -199,7 +199,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
|
||||
continue;
|
||||
}
|
||||
|
||||
updateStatus("<b>" + _("Updating from {0}", linkify(updateURL)) + "</b>");
|
||||
updateStatus("<b>" + _t("Updating from {0}", linkify(updateURL)) + "</b>");
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("Selected update URL: " + updateURL);
|
||||
|
||||
@@ -259,7 +259,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
|
||||
if (_isPartial)
|
||||
return;
|
||||
long d = currentWrite + bytesTransferred;
|
||||
String status = "<b>" + _("Updating") + "</b>";
|
||||
String status = "<b>" + _t("Updating") + "</b>";
|
||||
_mgr.notifyProgress(this, status, d, d + bytesRemaining);
|
||||
}
|
||||
|
||||
@@ -272,7 +272,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
|
||||
if (newer) {
|
||||
_newVersion = newVersion;
|
||||
} else {
|
||||
updateStatus("<b>" + _("No new version found at {0}", linkify(url)) + "</b>");
|
||||
updateStatus("<b>" + _t("No new version found at {0}", linkify(url)) + "</b>");
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Found old version \"" + newVersion + "\" at " + url);
|
||||
}
|
||||
@@ -295,7 +295,7 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
|
||||
if (_log.shouldLog(Log.WARN))
|
||||
_log.warn("Update from " + url + " did not download completely (" +
|
||||
bytesRemaining + " remaining after " + currentAttempt + " tries)");
|
||||
updateStatus("<b>" + _("Transfer failed from {0}", linkify(url)) + "</b>");
|
||||
updateStatus("<b>" + _t("Transfer failed from {0}", linkify(url)) + "</b>");
|
||||
_mgr.notifyAttemptFailed(this, url, null);
|
||||
// update() will call notifyTaskFailed() after last URL
|
||||
}
|
||||
@@ -313,15 +313,15 @@ class UpdateRunner extends I2PAppThread implements UpdateTask, EepGet.StatusList
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
protected String _(String s) {
|
||||
return _mgr._(s);
|
||||
protected String _t(String s) {
|
||||
return _mgr._t(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* translate a string with a parameter
|
||||
*/
|
||||
protected String _(String s, Object o) {
|
||||
return _mgr._(s, o);
|
||||
protected String _t(String s, Object o) {
|
||||
return _mgr._t(s, o);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BanlistRenderer {
|
||||
|
||||
entries.putAll(_context.banlist().getEntries());
|
||||
if (entries.isEmpty()) {
|
||||
buf.append("<i>").append(_("none")).append("</i>");
|
||||
buf.append("<i>").append(_t("none")).append("</i>");
|
||||
out.write(buf.toString());
|
||||
return;
|
||||
}
|
||||
@@ -62,24 +62,24 @@ public class BanlistRenderer {
|
||||
buf.append(' ');
|
||||
String expireString = DataHelper.formatDuration2(expires);
|
||||
if (key.equals(Hash.FAKE_HASH))
|
||||
buf.append(_("Permanently banned"));
|
||||
buf.append(_t("Permanently banned"));
|
||||
else if (expires < 5l*24*60*60*1000)
|
||||
buf.append(_("Temporary ban expiring in {0}", expireString));
|
||||
buf.append(_t("Temporary ban expiring in {0}", expireString));
|
||||
else
|
||||
buf.append(_("Banned until restart or in {0}", expireString));
|
||||
buf.append(_t("Banned until restart or in {0}", expireString));
|
||||
Set<String> transports = entry.transports;
|
||||
if ( (transports != null) && (!transports.isEmpty()) )
|
||||
buf.append(" on the following transport: ").append(transports);
|
||||
if (entry.cause != null) {
|
||||
buf.append("<br>\n");
|
||||
if (entry.causeCode != null)
|
||||
buf.append(_(entry.cause, entry.causeCode));
|
||||
buf.append(_t(entry.cause, entry.causeCode));
|
||||
else
|
||||
buf.append(_(entry.cause));
|
||||
buf.append(_t(entry.cause));
|
||||
}
|
||||
if (!key.equals(Hash.FAKE_HASH)) {
|
||||
buf.append(" (<a href=\"configpeer?peer=").append(key.toBase64())
|
||||
.append("#unsh\">").append(_("unban now")).append("</a>)");
|
||||
.append("#unsh\">").append(_t("unban now")).append("</a>)");
|
||||
}
|
||||
buf.append("</li>\n");
|
||||
}
|
||||
@@ -89,23 +89,23 @@ public class BanlistRenderer {
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s) {
|
||||
private String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
/**
|
||||
* translate a string with a parameter
|
||||
* This is a lot more expensive than _(s), so use sparingly.
|
||||
* This is a lot more expensive than _t(s), so use sparingly.
|
||||
*
|
||||
* @param s string to be translated containing {0}
|
||||
* The {0} will be replaced by the parameter.
|
||||
* Single quotes must be doubled, i.e. ' -> '' in the string.
|
||||
* @param o parameter, not translated.
|
||||
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
|
||||
* To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
|
||||
* Do not double the single quotes in the parameter.
|
||||
* Use autoboxing to call with ints, longs, floats, etc.
|
||||
*/
|
||||
private String _(String s, Object o) {
|
||||
private String _t(String s, Object o) {
|
||||
return Messages.getString(s, o, _context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,9 +146,9 @@ public class CSSHelper extends HelperBase {
|
||||
public String title(String s) {
|
||||
StringBuilder buf = new StringBuilder(128);
|
||||
buf.append("<title>")
|
||||
.append(_("I2P Router Console"))
|
||||
.append(_t("I2P Router Console"))
|
||||
.append(" - ")
|
||||
.append(_(s))
|
||||
.append(_t(s))
|
||||
.append("</title>");
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ConfigAdvancedHandler extends FormHandler {
|
||||
} catch (IOException ioe) {
|
||||
_log.error("Config error", ioe);
|
||||
addFormError(ioe.toString());
|
||||
addFormError(_("Error updating the configuration - please see the error logs"));
|
||||
addFormError(_t("Error updating the configuration - please see the error logs"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -69,9 +69,9 @@ public class ConfigAdvancedHandler extends FormHandler {
|
||||
|
||||
boolean saved = _context.router().saveConfig(props, unsetKeys);
|
||||
if (saved)
|
||||
addFormNotice(_("Configuration saved successfully"));
|
||||
addFormNotice(_t("Configuration saved successfully"));
|
||||
else
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
|
||||
//if (_forceRestart) {
|
||||
// addFormNotice("Performing a soft restart");
|
||||
@@ -93,8 +93,8 @@ public class ConfigAdvancedHandler extends FormHandler {
|
||||
_context.router().rebuildRouterInfo();
|
||||
}
|
||||
if (saved)
|
||||
addFormNotice(_("Configuration saved successfully"));
|
||||
addFormNotice(_t("Configuration saved successfully"));
|
||||
else
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,27 +45,27 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
_action = "Save Client Configuration";
|
||||
}
|
||||
|
||||
if (_action.equals(_("Save Client Configuration"))) {
|
||||
if (_action.equals(_t("Save Client Configuration"))) {
|
||||
saveClientChanges();
|
||||
return;
|
||||
}
|
||||
if (_action.equals(_("Save Interface Configuration"))) {
|
||||
if (_action.equals(_t("Save Interface Configuration"))) {
|
||||
saveInterfaceChanges();
|
||||
return;
|
||||
}
|
||||
if (_action.equals(_("Save WebApp Configuration"))) {
|
||||
if (_action.equals(_t("Save WebApp Configuration"))) {
|
||||
saveWebAppChanges();
|
||||
return;
|
||||
}
|
||||
boolean pluginsEnabled = PluginStarter.pluginsEnabled(_context);
|
||||
if (_action.equals(_("Save Plugin Configuration"))) {
|
||||
if (_action.equals(_t("Save Plugin Configuration"))) {
|
||||
if (pluginsEnabled)
|
||||
savePluginChanges();
|
||||
else
|
||||
addFormError("Plugins disabled");
|
||||
return;
|
||||
}
|
||||
if (_action.equals(_("Install Plugin"))) {
|
||||
if (_action.equals(_t("Install Plugin"))) {
|
||||
if (pluginsEnabled &&
|
||||
(_context.getBooleanPropertyDefaultTrue(ConfigClientsHelper.PROP_ENABLE_PLUGIN_INSTALL) ||
|
||||
isAdvanced()))
|
||||
@@ -74,7 +74,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
addFormError("Plugins disabled");
|
||||
return;
|
||||
}
|
||||
if (_action.equals(_("Install Plugin from File"))) {
|
||||
if (_action.equals(_t("Install Plugin from File"))) {
|
||||
if (pluginsEnabled &&
|
||||
(_context.getBooleanPropertyDefaultTrue(ConfigClientsHelper.PROP_ENABLE_PLUGIN_INSTALL) ||
|
||||
isAdvanced()))
|
||||
@@ -83,7 +83,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
addFormError("Plugins disabled");
|
||||
return;
|
||||
}
|
||||
if (_action.equals(_("Update All Installed Plugins"))) {
|
||||
if (_action.equals(_t("Update All Installed Plugins"))) {
|
||||
if (pluginsEnabled)
|
||||
updateAllPlugins();
|
||||
else
|
||||
@@ -135,14 +135,14 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
// I tried to check to see if the plugin was ran elsewhere,
|
||||
// and it sait it was when it was not. -- Sponge
|
||||
} catch (Throwable e) {
|
||||
addFormError(_("Error stopping plugin {0}", app) + ": " + e);
|
||||
addFormError(_t("Error stopping plugin {0}", app) + ": " + e);
|
||||
_log.error("Error stopping plugin " + app, e);
|
||||
}
|
||||
try {
|
||||
PluginStarter.deletePlugin(_context, app);
|
||||
addFormNotice(_("Deleted plugin {0}", app));
|
||||
addFormNotice(_t("Deleted plugin {0}", app));
|
||||
} catch (Throwable e) {
|
||||
addFormError(_("Error deleting plugin {0}", app) + ": " + e);
|
||||
addFormError(_t("Error deleting plugin {0}", app) + ": " + e);
|
||||
_log.error("Error deleting plugin " + app, e);
|
||||
}
|
||||
} else {
|
||||
@@ -167,17 +167,17 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
try {
|
||||
if (pluginsEnabled) {
|
||||
PluginStarter.stopPlugin(_context, app);
|
||||
addFormNotice(_("Stopped plugin {0}", app));
|
||||
addFormNotice(_t("Stopped plugin {0}", app));
|
||||
} else {
|
||||
addFormError("Plugins disabled");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
addFormError(_("Error stopping plugin {0}", app) + ": " + e);
|
||||
addFormError(_t("Error stopping plugin {0}", app) + ": " + e);
|
||||
_log.error("Error stopping plugin " + app, e);
|
||||
}
|
||||
} else {
|
||||
WebAppStarter.stopWebApp(app);
|
||||
addFormNotice(_("Stopped webapp {0}", app));
|
||||
addFormNotice(_t("Stopped webapp {0}", app));
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -206,7 +206,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
}
|
||||
|
||||
// label (IE)
|
||||
String xStart = _("Start");
|
||||
String xStart = _t("Start");
|
||||
if (_action.toLowerCase(Locale.US).startsWith(xStart + "<span class=hide> ") &&
|
||||
_action.toLowerCase(Locale.US).endsWith("</span>")) {
|
||||
// IE sucks
|
||||
@@ -229,7 +229,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//addFormError(_("Unsupported") + ' ' + _action + '.');
|
||||
//addFormError(_t("Unsupported") + ' ' + _action + '.');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -279,13 +279,13 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
ClientAppConfig ca = new ClientAppConfig(clss, name, args, 2*60*1000,
|
||||
_settings.get(newClient + ".enabled") != null);
|
||||
clients.add(ca);
|
||||
addFormNotice(_("New client added") + ": " + name + " (" + clss + ").");
|
||||
addFormNotice(_t("New client added") + ": " + name + " (" + clss + ").");
|
||||
}
|
||||
}
|
||||
|
||||
ClientAppConfig.writeClientAppConfig(_context, clients);
|
||||
addFormNotice(_("Client configuration saved successfully"));
|
||||
//addFormNotice(_("Restart required to take effect"));
|
||||
addFormNotice(_t("Client configuration saved successfully"));
|
||||
//addFormNotice(_t("Restart required to take effect"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -294,7 +294,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
private void stopClient(int i) {
|
||||
List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context);
|
||||
if (i >= clients.size()) {
|
||||
addFormError(_("Bad client index."));
|
||||
addFormError(_t("Bad client index."));
|
||||
return;
|
||||
}
|
||||
ClientAppConfig ca = clients.get(i);
|
||||
@@ -303,7 +303,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
try {
|
||||
// todo parseArgs(ca.stopArgs) ?
|
||||
clientApp.shutdown(null);
|
||||
addFormNotice(_("Client {0} stopped", ca.clientName));
|
||||
addFormNotice(_t("Client {0} stopped", ca.clientName));
|
||||
// Give a chance for status to update
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
@@ -320,12 +320,12 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
private void startClient(int i) {
|
||||
List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context);
|
||||
if (i >= clients.size()) {
|
||||
addFormError(_("Bad client index."));
|
||||
addFormError(_t("Bad client index."));
|
||||
return;
|
||||
}
|
||||
ClientAppConfig ca = clients.get(i);
|
||||
LoadClientAppsJob.runClient(ca.className, ca.clientName, LoadClientAppsJob.parseArgs(ca.args), _context, _log);
|
||||
addFormNotice(_("Client {0} started", ca.clientName));
|
||||
addFormNotice(_t("Client {0} started", ca.clientName));
|
||||
// Give a chance for status to update
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
@@ -335,12 +335,12 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
private void deleteClient(int i) {
|
||||
List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context);
|
||||
if (i < 0 || i >= clients.size()) {
|
||||
addFormError(_("Bad client index."));
|
||||
addFormError(_t("Bad client index."));
|
||||
return;
|
||||
}
|
||||
ClientAppConfig ca = clients.remove(i);
|
||||
ClientAppConfig.writeClientAppConfig(_context, clients);
|
||||
addFormNotice(_("Client {0} deleted", ca.clientName));
|
||||
addFormNotice(_t("Client {0} deleted", ca.clientName));
|
||||
}
|
||||
|
||||
private void saveWebAppChanges() {
|
||||
@@ -355,7 +355,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
props.setProperty(name, "" + (val != null));
|
||||
}
|
||||
RouterConsoleRunner.storeWebAppProperties(_context, props);
|
||||
addFormNotice(_("WebApp configuration saved."));
|
||||
addFormNotice(_t("WebApp configuration saved."));
|
||||
}
|
||||
|
||||
private void savePluginChanges() {
|
||||
@@ -369,7 +369,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
props.setProperty(name, "" + (val != null));
|
||||
}
|
||||
PluginStarter.storePluginProperties(props);
|
||||
addFormNotice(_("Plugin configuration saved."));
|
||||
addFormNotice(_t("Plugin configuration saved."));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -384,20 +384,20 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
File path = new File(_context.getBaseDir(), "webapps");
|
||||
path = new File(path, app + ".war");
|
||||
WebAppStarter.startWebApp(_context, s, app, path.getAbsolutePath());
|
||||
addFormNoticeNoEscape(_("WebApp") + " <a href=\"/" + app + "/\">" + _(app) + "</a> " + _("started") + '.');
|
||||
addFormNoticeNoEscape(_t("WebApp") + " <a href=\"/" + app + "/\">" + _t(app) + "</a> " + _t("started") + '.');
|
||||
} catch (Throwable e) {
|
||||
addFormError(_("Failed to start") + ' ' + _(app) + " " + e + '.');
|
||||
addFormError(_t("Failed to start") + ' ' + _t(app) + " " + e + '.');
|
||||
_log.error("Failed to start webapp " + app, e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
addFormError(_("Failed to find server."));
|
||||
addFormError(_t("Failed to find server."));
|
||||
}
|
||||
|
||||
private void installPlugin() {
|
||||
String url = getJettyString("pluginURL");
|
||||
if (url == null || url.length() <= 0) {
|
||||
addFormError(_("No plugin URL specified."));
|
||||
addFormError(_t("No plugin URL specified."));
|
||||
return;
|
||||
}
|
||||
installPlugin(null, url);
|
||||
@@ -418,7 +418,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
try {
|
||||
// non-null but zero bytes if no file entered, don't know why
|
||||
if (in == null || in.available() <= 0) {
|
||||
addFormError(_("You must enter a file"));
|
||||
addFormError(_t("You must enter a file"));
|
||||
return;
|
||||
}
|
||||
DataHelper.read(in, magic);
|
||||
@@ -461,7 +461,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
if (status != null && status.length() > 0)
|
||||
addFormNoticeNoEscape(status);
|
||||
} catch (IOException ioe) {
|
||||
addFormError(_("Install from file failed") + " - " + ioe.getMessage());
|
||||
addFormError(_t("Install from file failed") + " - " + ioe.getMessage());
|
||||
} finally {
|
||||
// it's really a ByteArrayInputStream but we'll play along...
|
||||
if (in != null)
|
||||
@@ -476,7 +476,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
if (url == null)
|
||||
url = props.getProperty("updateURL");
|
||||
if (url == null) {
|
||||
addFormError(_("No update URL specified for {0}",app));
|
||||
addFormError(_t("No update URL specified for {0}",app));
|
||||
return;
|
||||
}
|
||||
installPlugin(app, url);
|
||||
@@ -485,12 +485,12 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
/** @since 0.8.13 */
|
||||
private void updateAllPlugins() {
|
||||
if (NewsHelper.isAnyUpdateInProgress()) {
|
||||
addFormError(_("Plugin or update download already in progress."));
|
||||
addFormError(_t("Plugin or update download already in progress."));
|
||||
return;
|
||||
}
|
||||
if (!verifyProxy())
|
||||
return;
|
||||
addFormNotice(_("Updating all plugins"));
|
||||
addFormNotice(_t("Updating all plugins"));
|
||||
PluginStarter.updateAll(_context);
|
||||
// So that update() will post a status to the summary bar before we reload
|
||||
try {
|
||||
@@ -509,14 +509,14 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
return;
|
||||
}
|
||||
if (mgr.isUpdateInProgress()) {
|
||||
addFormError(_("Plugin or update download already in progress."));
|
||||
addFormError(_t("Plugin or update download already in progress."));
|
||||
return;
|
||||
}
|
||||
URI uri;
|
||||
try {
|
||||
uri = new URI(url);
|
||||
} catch (URISyntaxException use) {
|
||||
addFormError(_("Bad URL {0}", url));
|
||||
addFormError(_t("Bad URL {0}", url));
|
||||
return;
|
||||
}
|
||||
if (!url.startsWith("file:")) {
|
||||
@@ -525,9 +525,9 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
}
|
||||
if (mgr.installPlugin(app, uri)) {
|
||||
if (url.startsWith("file:"))
|
||||
addFormNotice(_("Installing plugin from {0}", uri.getPath()));
|
||||
addFormNotice(_t("Installing plugin from {0}", uri.getPath()));
|
||||
else
|
||||
addFormNotice(_("Downloading plugin from {0}", url));
|
||||
addFormNotice(_t("Downloading plugin from {0}", url));
|
||||
} else {
|
||||
addFormError("Cannot install, check logs");
|
||||
}
|
||||
@@ -546,7 +546,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
if (!verifyProxy())
|
||||
return;
|
||||
mgr.check(PLUGIN, app);
|
||||
addFormNotice(_("Checking plugin {0} for updates", app));
|
||||
addFormNotice(_t("Checking plugin {0} for updates", app));
|
||||
// So that update() will post a status to the summary bar before we reload
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
@@ -570,16 +570,16 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0);
|
||||
if (!rv)
|
||||
addFormError(_("HTTP client proxy tunnel must be running"));
|
||||
addFormError(_t("HTTP client proxy tunnel must be running"));
|
||||
return rv;
|
||||
}
|
||||
|
||||
private void startPlugin(String app) {
|
||||
try {
|
||||
PluginStarter.startPlugin(_context, app);
|
||||
addFormNotice(_("Started plugin {0}", app));
|
||||
addFormNotice(_t("Started plugin {0}", app));
|
||||
} catch (Throwable e) {
|
||||
addFormError(_("Error starting plugin {0}", app) + ": " + e);
|
||||
addFormError(_t("Error starting plugin {0}", app) + ": " + e);
|
||||
_log.error("Error starting plugin " + app, e);
|
||||
}
|
||||
}
|
||||
@@ -601,7 +601,7 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
if (user != null && pw != null && user.length() > 0 && pw.length() > 0) {
|
||||
ConsolePasswordManager mgr = new ConsolePasswordManager(_context);
|
||||
mgr.saveHash(ConfigClientsHelper.PROP_AUTH, user, pw);
|
||||
addFormNotice(_("Added user {0}", user));
|
||||
addFormNotice(_t("Added user {0}", user));
|
||||
}
|
||||
String mode = getJettyString("mode");
|
||||
boolean disabled = "0".equals(mode);
|
||||
@@ -616,9 +616,9 @@ public class ConfigClientsHandler extends FormHandler {
|
||||
"::".equals(intfc);
|
||||
changes.put(ConfigClientsHelper.BIND_ALL_INTERFACES, Boolean.toString(all));
|
||||
if (_context.router().saveConfig(changes, null)) {
|
||||
addFormNotice(_("Interface configuration saved"));
|
||||
addFormNotice(_("Restart required to take effect"));
|
||||
addFormNotice(_t("Interface configuration saved"));
|
||||
addFormNotice(_t("Restart required to take effect"));
|
||||
} else
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
public void setEdit(String edit) {
|
||||
if (edit == null)
|
||||
return;
|
||||
String xStart = _("Edit");
|
||||
String xStart = _t("Edit");
|
||||
if (edit.startsWith(xStart + "<span class=hide> ") &&
|
||||
edit.endsWith("</span>")) {
|
||||
// IE sucks
|
||||
@@ -104,7 +104,7 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
_edit = edit.substring(5);
|
||||
} else if (edit.startsWith(xStart + ' ')) {
|
||||
_edit = edit.substring(xStart.length() + 1);
|
||||
} else if ((_("Add Client")).equals(edit)) {
|
||||
} else if ((_t("Add Client")).equals(edit)) {
|
||||
_edit = "new";
|
||||
}
|
||||
}
|
||||
@@ -113,10 +113,10 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
public String getForm1() {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<table>\n" +
|
||||
"<tr><th align=\"right\">").append(_("Client")).append("</th><th>")
|
||||
.append(_("Run at Startup?")).append("</th><th>")
|
||||
.append(_("Control")).append("</th><th align=\"left\">")
|
||||
.append(_("Class and arguments")).append("</th></tr>\n");
|
||||
"<tr><th align=\"right\">").append(_t("Client")).append("</th><th>")
|
||||
.append(_t("Run at Startup?")).append("</th><th>")
|
||||
.append(_t("Control")).append("</th><th align=\"left\">")
|
||||
.append(_t("Class and arguments")).append("</th></tr>\n");
|
||||
|
||||
boolean allowEdit = isClientChangeEnabled();
|
||||
List<ClientAppConfig> clients = ClientAppConfig.getClientApps(_context);
|
||||
@@ -125,7 +125,7 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
ClientAppConfig ca = clients.get(cur);
|
||||
String xname = ca.clientName;
|
||||
if (xname.length() > 0)
|
||||
xname = _(xname);
|
||||
xname = _t(xname);
|
||||
cacs.add(new CAC(cur, ca, xname));
|
||||
}
|
||||
Collections.sort(cacs, new CACComparator());
|
||||
@@ -199,10 +199,10 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
public String getForm2() {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<table>\n" +
|
||||
"<tr><th align=\"right\">").append(_("WebApp")).append("</th><th>")
|
||||
.append(_("Run at Startup?")).append("</th><th>")
|
||||
.append(_("Control")).append("</th><th align=\"left\">")
|
||||
.append(_("Description")).append("</th></tr>\n");
|
||||
"<tr><th align=\"right\">").append(_t("WebApp")).append("</th><th>")
|
||||
.append(_t("Run at Startup?")).append("</th><th>")
|
||||
.append(_t("Control")).append("</th><th align=\"left\">")
|
||||
.append(_t("Description")).append("</th></tr>\n");
|
||||
Properties props = RouterConsoleRunner.webAppProperties(_context);
|
||||
Set<String> keys = new TreeSet<String>(props.stringPropertyNames());
|
||||
for (String name : keys) {
|
||||
@@ -228,10 +228,10 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
public String getForm3() {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<table>\n" +
|
||||
"<tr><th align=\"right\">").append(_("Plugin")).append("</th><th>")
|
||||
.append(_("Run at Startup?")).append("</th><th>")
|
||||
.append(_("Control")).append("</th><th align=\"left\">")
|
||||
.append(_("Description")).append("</th></tr>\n");
|
||||
"<tr><th align=\"right\">").append(_t("Plugin")).append("</th><th>")
|
||||
.append(_t("Run at Startup?")).append("</th><th>")
|
||||
.append(_t("Control")).append("</th><th align=\"left\">")
|
||||
.append(_t("Description")).append("</th></tr>\n");
|
||||
Properties props = PluginStarter.pluginProperties();
|
||||
Set<String> keys = new TreeSet<String>(props.stringPropertyNames());
|
||||
for (String name : keys) {
|
||||
@@ -245,9 +245,9 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
continue;
|
||||
StringBuilder desc = new StringBuilder(256);
|
||||
desc.append("<table border=\"0\">")
|
||||
.append("<tr><td><b>").append(_("Version")).append("</b></td><td>").append(stripHTML(appProps, "version"))
|
||||
.append("<tr><td><b>").append(_t("Version")).append("</b></td><td>").append(stripHTML(appProps, "version"))
|
||||
.append("<tr><td><b>")
|
||||
.append(_("Signed by")).append("</b></td><td>");
|
||||
.append(_t("Signed by")).append("</b></td><td>");
|
||||
String s = stripHTML(appProps, "signer");
|
||||
if (s != null) {
|
||||
if (s.indexOf("@") > 0)
|
||||
@@ -264,13 +264,13 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
if (ms > 0) {
|
||||
String date = (new SimpleDateFormat("yyyy-MM-dd HH:mm")).format(new Date(ms));
|
||||
desc.append("<tr><td><b>")
|
||||
.append(_("Date")).append("</b></td><td>").append(date);
|
||||
.append(_t("Date")).append("</b></td><td>").append(date);
|
||||
}
|
||||
}
|
||||
s = stripHTML(appProps, "author");
|
||||
if (s != null) {
|
||||
desc.append("<tr><td><b>")
|
||||
.append(_("Author")).append("</b></td><td>");
|
||||
.append(_t("Author")).append("</b></td><td>");
|
||||
if (s.indexOf("@") > 0)
|
||||
desc.append("<a href=\"mailto:").append(s).append("\">").append(s).append("</a>");
|
||||
else
|
||||
@@ -281,24 +281,24 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
s = stripHTML(appProps, "description");
|
||||
if (s != null) {
|
||||
desc.append("<tr><td><b>")
|
||||
.append(_("Description")).append("</b></td><td>").append(s);
|
||||
.append(_t("Description")).append("</b></td><td>").append(s);
|
||||
}
|
||||
s = stripHTML(appProps, "license");
|
||||
if (s != null) {
|
||||
desc.append("<tr><td><b>")
|
||||
.append(_("License")).append("</b></td><td>").append(s);
|
||||
.append(_t("License")).append("</b></td><td>").append(s);
|
||||
}
|
||||
s = stripHTML(appProps, "websiteURL");
|
||||
if (s != null) {
|
||||
desc.append("<tr><td>")
|
||||
.append("<a href=\"").append(s).append("\">").append(_("Website")).append("</a><td> ");
|
||||
.append("<a href=\"").append(s).append("\">").append(_t("Website")).append("</a><td> ");
|
||||
}
|
||||
String updateURL = stripHTML(appProps, "updateURL.su3");
|
||||
if (updateURL == null)
|
||||
updateURL = stripHTML(appProps, "updateURL");
|
||||
if (updateURL != null) {
|
||||
desc.append("<tr><td>")
|
||||
.append("<a href=\"").append(updateURL).append("\">").append(_("Update link")).append("</a><td> ");
|
||||
.append("<a href=\"").append(updateURL).append("\">").append(_t("Update link")).append("</a><td> ");
|
||||
}
|
||||
desc.append("</table>");
|
||||
boolean isRunning = PluginStarter.isPluginRunning(app, _context);
|
||||
@@ -328,15 +328,15 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
String link = "/";
|
||||
if (! RouterConsoleRunner.ROUTERCONSOLE.equals(name))
|
||||
link += name + "/";
|
||||
buf.append("<a href=\"").append(link).append("\">").append(_(name)).append("</a>");
|
||||
buf.append("<a href=\"").append(link).append("\">").append(_t(name)).append("</a>");
|
||||
} else if (edit && !ro) {
|
||||
buf.append("<input type=\"text\" name=\"name").append(index).append("\" value=\"");
|
||||
if (name.length() > 0)
|
||||
buf.append(_(name));
|
||||
buf.append(_t(name));
|
||||
buf.append("\" >");
|
||||
} else {
|
||||
if (name.length() > 0)
|
||||
buf.append(_(name));
|
||||
buf.append(_t(name));
|
||||
}
|
||||
buf.append("</td><td align=\"center\" width=\"10%\"><input type=\"checkbox\" class=\"optbox\" name=\"").append(index).append(".enabled\" value=\"true\" ");
|
||||
if (enabled) {
|
||||
@@ -349,26 +349,26 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
// remove if you wnat to put them back
|
||||
if (showStartButton && (!ro) && !edit) {
|
||||
buf.append("<button type=\"submit\" class=\"Xaccept\" name=\"action\" value=\"Start ").append(index).append("\" >")
|
||||
.append(_("Start")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
.append(_t("Start")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
}
|
||||
if (showStopButton && (!edit))
|
||||
buf.append("<button type=\"submit\" class=\"Xstop\" name=\"action\" value=\"Stop ").append(index).append("\" >")
|
||||
.append(_("Stop")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
.append(_t("Stop")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
if (isClientChangeEnabled() && showEditButton && (!edit) && !ro)
|
||||
buf.append("<button type=\"submit\" class=\"Xadd\" name=\"edit\" value=\"Edit ").append(index).append("\" >")
|
||||
.append(_("Edit")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
.append(_t("Edit")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
if (showUpdateButton && (!edit) && !ro) {
|
||||
buf.append("<button type=\"submit\" class=\"Xcheck\" name=\"action\" value=\"Check ").append(index).append("\" >")
|
||||
.append(_("Check for updates")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
.append(_t("Check for updates")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
buf.append("<button type=\"submit\" class=\"Xdownload\" name=\"action\" value=\"Update ").append(index).append("\" >")
|
||||
.append(_("Update")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
.append(_t("Update")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
}
|
||||
if (showDeleteButton && (!edit) && !ro) {
|
||||
buf.append("<button type=\"submit\" class=\"Xdelete\" name=\"action\" value=\"Delete ").append(index)
|
||||
.append("\" onclick=\"if (!confirm('")
|
||||
.append(_("Are you sure you want to delete {0}?", _(name)))
|
||||
.append(_t("Are you sure you want to delete {0}?", _t(name)))
|
||||
.append("')) { return false; }\">")
|
||||
.append(_("Delete")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
.append(_t("Delete")).append("<span class=hide> ").append(index).append("</span></button>");
|
||||
}
|
||||
buf.append("</td><td align=\"left\" width=\"50%\">");
|
||||
if (edit && !ro) {
|
||||
|
||||
@@ -18,15 +18,15 @@ public class ConfigHomeHandler extends FormHandler {
|
||||
protected void processForm() {
|
||||
if (_action == null) return;
|
||||
String group = getJettyString("group");
|
||||
boolean deleting = _action.equals(_("Delete selected"));
|
||||
boolean adding = _action.equals(_("Add item"));
|
||||
boolean restoring = _action.equals(_("Restore defaults"));
|
||||
if (_action.equals(_("Save")) && "0".equals(group)) {
|
||||
boolean deleting = _action.equals(_t("Delete selected"));
|
||||
boolean adding = _action.equals(_t("Add item"));
|
||||
boolean restoring = _action.equals(_t("Restore defaults"));
|
||||
if (_action.equals(_t("Save")) && "0".equals(group)) {
|
||||
boolean old = _context.getBooleanProperty(HomeHelper.PROP_OLDHOME);
|
||||
boolean nnew = getJettyString("oldHome") != null;
|
||||
if (old != nnew) {
|
||||
_context.router().saveConfig(HomeHelper.PROP_OLDHOME, "" + nnew);
|
||||
addFormNotice(_("Home page changed"));
|
||||
addFormNotice(_t("Home page changed"));
|
||||
}
|
||||
} else if (adding || deleting || restoring) {
|
||||
String prop;
|
||||
@@ -48,7 +48,7 @@ public class ConfigHomeHandler extends FormHandler {
|
||||
//_context.router().saveConfig(prop, dflt);
|
||||
// remove config so user will see updates
|
||||
_context.router().saveConfig(prop, null);
|
||||
addFormNotice(_("Restored default settings"));
|
||||
addFormNotice(_t("Restored default settings"));
|
||||
return;
|
||||
}
|
||||
String config = _context.getProperty(prop, dflt);
|
||||
@@ -60,12 +60,12 @@ public class ConfigHomeHandler extends FormHandler {
|
||||
if (adding) {
|
||||
String name = getJettyString("nofilter_name");
|
||||
if (name == null || name.length() <= 0) {
|
||||
addFormError(_("No name entered"));
|
||||
addFormError(_t("No name entered"));
|
||||
return;
|
||||
}
|
||||
String url = getJettyString("nofilter_url");
|
||||
if (url == null || url.length() <= 0) {
|
||||
addFormError(_("No URL entered"));
|
||||
addFormError(_t("No URL entered"));
|
||||
return;
|
||||
}
|
||||
// these would get double-escaped so we can't do it this way...
|
||||
@@ -81,7 +81,7 @@ public class ConfigHomeHandler extends FormHandler {
|
||||
else
|
||||
app = new HomeHelper.App(name, "", url, "/themes/console/images/question.png");
|
||||
apps.add(app);
|
||||
addFormNotice(_("Added") + ": " + app.name);
|
||||
addFormNotice(_t("Added") + ": " + app.name);
|
||||
} else {
|
||||
// deleting
|
||||
Set<String> toDelete = new HashSet<String>();
|
||||
@@ -98,13 +98,13 @@ public class ConfigHomeHandler extends FormHandler {
|
||||
HomeHelper.App app = iter.next();
|
||||
if (toDelete.contains(app.name)) {
|
||||
iter.remove();
|
||||
addFormNotice(_("Removed") + ": " + app.name);
|
||||
addFormNotice(_t("Removed") + ": " + app.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
HomeHelper.saveApps(_context, prop, apps, !("3".equals(group)));
|
||||
} else {
|
||||
//addFormError(_("Unsupported"));
|
||||
//addFormError(_t("Unsupported"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ public class ConfigKeyringHandler extends FormHandler {
|
||||
@Override
|
||||
protected void processForm() {
|
||||
if (_action == null) return;
|
||||
boolean adding = _action.equals(_("Add key"));
|
||||
if (adding || _action.equals(_("Delete key"))) {
|
||||
boolean adding = _action.equals(_t("Add key"));
|
||||
if (adding || _action.equals(_t("Delete key"))) {
|
||||
if (_peer == null)
|
||||
addFormError(_("You must enter a destination"));
|
||||
addFormError(_t("You must enter a destination"));
|
||||
if (_key == null && adding)
|
||||
addFormError(_("You must enter a key"));
|
||||
addFormError(_t("You must enter a key"));
|
||||
if (_peer == null || (_key == null && adding))
|
||||
return;
|
||||
Hash h = ConvertToHash.getHash(_peer);
|
||||
@@ -31,22 +31,22 @@ public class ConfigKeyringHandler extends FormHandler {
|
||||
} catch (DataFormatException dfe) {}
|
||||
if (h != null && h.getData() != null && sk.getData() != null) {
|
||||
_context.keyRing().put(h, sk);
|
||||
addFormNotice(_("Key for") + " " + h.toBase64() + " " + _("added to keyring"));
|
||||
addFormNotice(_t("Key for") + " " + h.toBase64() + " " + _t("added to keyring"));
|
||||
} else {
|
||||
addFormError(_("Invalid destination or key"));
|
||||
addFormError(_t("Invalid destination or key"));
|
||||
}
|
||||
} else { // Delete
|
||||
if (h != null && h.getData() != null) {
|
||||
if (_context.keyRing().remove(h) != null)
|
||||
addFormNotice(_("Key for") + " " + h.toBase64() + " " + _("removed from keyring"));
|
||||
addFormNotice(_t("Key for") + " " + h.toBase64() + " " + _t("removed from keyring"));
|
||||
else
|
||||
addFormNotice(_("Key for") + " " + h.toBase64() + " " + _("not found in keyring"));
|
||||
addFormNotice(_t("Key for") + " " + h.toBase64() + " " + _t("not found in keyring"));
|
||||
} else {
|
||||
addFormError(_("Invalid destination"));
|
||||
addFormError(_t("Invalid destination"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//addFormError(_("Unsupported"));
|
||||
//addFormError(_t("Unsupported"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ public class ConfigLoggingHandler extends FormHandler {
|
||||
props.setProperty(_newLogClass, _newLogLevel);
|
||||
_context.logManager().setLimits(props);
|
||||
shouldSave = true;
|
||||
addFormNotice(_("Log overrides updated"));
|
||||
addFormNotice(_t("Log overrides updated"));
|
||||
} catch (IOException ioe) {
|
||||
// shouldn't ever happen (BAIS shouldnt cause an IOE)
|
||||
_context.logManager().getLog(ConfigLoggingHandler.class).error("Error reading from the props?", ioe);
|
||||
@@ -160,7 +160,7 @@ public class ConfigLoggingHandler extends FormHandler {
|
||||
boolean saved = _context.logManager().saveConfig();
|
||||
|
||||
if (saved)
|
||||
addFormNotice(_("Log configuration saved"));
|
||||
addFormNotice(_t("Log configuration saved"));
|
||||
else
|
||||
addFormError("Error saving the configuration (applied but not saved) - please see the error logs");
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ public class ConfigLoggingHelper extends HelperBase {
|
||||
buf.append(prefix).append('=').append(level).append('\n');
|
||||
}
|
||||
buf.append("</textarea><br>\n");
|
||||
buf.append("<i>").append(_("Add additional logging statements above. Example: net.i2p.router.tunnel=WARN")).append("</i><br>");
|
||||
buf.append("<i>").append(_("Or put entries in the logger.config file. Example: logger.record.net.i2p.router.tunnel=WARN")).append("</i><br>");
|
||||
buf.append("<i>").append(_("Valid levels are DEBUG, INFO, WARN, ERROR, CRIT")).append("</i>\n");
|
||||
buf.append("<i>").append(_t("Add additional logging statements above. Example: net.i2p.router.tunnel=WARN")).append("</i><br>");
|
||||
buf.append("<i>").append(_t("Or put entries in the logger.config file. Example: logger.record.net.i2p.router.tunnel=WARN")).append("</i><br>");
|
||||
buf.append("<i>").append(_t("Valid levels are DEBUG, INFO, WARN, ERROR, CRIT")).append("</i>\n");
|
||||
|
||||
/****
|
||||
// this is too big and ugly
|
||||
@@ -78,11 +78,11 @@ public class ConfigLoggingHelper extends HelperBase {
|
||||
buf.append("<option value=\"").append(l).append('\"');
|
||||
if (l.equals(cur))
|
||||
buf.append(" selected=\"selected\"");
|
||||
buf.append('>').append(_(l)).append("</option>\n");
|
||||
buf.append('>').append(_t(l)).append("</option>\n");
|
||||
}
|
||||
|
||||
if (showRemove)
|
||||
buf.append("<option value=\"remove\">").append(_("Remove")).append("</option>");
|
||||
buf.append("<option value=\"remove\">").append(_t("Remove")).append("</option>");
|
||||
buf.append("</select>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
@@ -119,7 +119,7 @@ public class ConfigLoggingHelper extends HelperBase {
|
||||
StringBuilder buf = new StringBuilder(65536);
|
||||
buf.append("<select name=\"newlogclass\">\n" +
|
||||
"<option value=\"\" selected=\"selected\">")
|
||||
.append(_("Select a class to add"))
|
||||
.append(_t("Select a class to add"))
|
||||
.append("</option>\n");
|
||||
|
||||
for (String l : sortedLogs) {
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ConfigNavHelper extends HelperBase {
|
||||
buf.append("<center>");
|
||||
List<Tab> tabs = new ArrayList<Tab>(pages.length);
|
||||
for (int i = 0; i < pages.length; i++) {
|
||||
tabs.add(new Tab(pages[i], _(titles[i])));
|
||||
tabs.add(new Tab(pages[i], _t(titles[i])));
|
||||
}
|
||||
Collections.sort(tabs, new TabComparator());
|
||||
for (int i = 0; i < tabs.size(); i++) {
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
|
||||
@Override
|
||||
protected void processForm() {
|
||||
if (_saveRequested || ( (_action != null) && (_("Save changes").equals(_action)) )) {
|
||||
if (_saveRequested || ( (_action != null) && (_t("Save changes").equals(_action)) )) {
|
||||
saveChanges();
|
||||
//} else if (_recheckReachabilityRequested) {
|
||||
// recheckReachability();
|
||||
@@ -145,7 +145,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
/****
|
||||
private void recheckReachability() {
|
||||
_context.commSystem().recheckReachability();
|
||||
addFormNotice(_("Rechecking router reachability..."));
|
||||
addFormNotice(_t("Rechecking router reachability..."));
|
||||
}
|
||||
****/
|
||||
|
||||
@@ -209,7 +209,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
}
|
||||
changes.put(UDPTransport.PROP_SOURCES, _udpAutoIP);
|
||||
if ((!oldUdp.equals(_udpAutoIP)) || (!oldUHost.equals(uhost))) {
|
||||
addFormNotice(_("Updating IP address"));
|
||||
addFormNotice(_t("Updating IP address"));
|
||||
restartRequired = true;
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
ch = true;
|
||||
}
|
||||
if (ch)
|
||||
addFormNotice(_("Updating IPv6 setting"));
|
||||
addFormNotice(_t("Updating IPv6 setting"));
|
||||
}
|
||||
|
||||
// NTCP Settings
|
||||
@@ -248,21 +248,21 @@ public class ConfigNetHandler extends FormHandler {
|
||||
if ((!oldAutoHost.equals(_ntcpAutoIP)) || ! oldNHost.equalsIgnoreCase(_ntcpHostname)) {
|
||||
boolean valid = true;
|
||||
if ("disabled".equals(_ntcpAutoIP)) {
|
||||
addFormNotice(_("Disabling TCP completely"));
|
||||
addFormNotice(_t("Disabling TCP completely"));
|
||||
} else if ("false".equals(_ntcpAutoIP) && _ntcpHostname.length() > 0) {
|
||||
valid = verifyAddress(_ntcpHostname);
|
||||
if (valid) {
|
||||
changes.put(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME, _ntcpHostname);
|
||||
addFormNotice(_("Updating TCP address to {0}", _ntcpHostname));
|
||||
addFormNotice(_t("Updating TCP address to {0}", _ntcpHostname));
|
||||
} else {
|
||||
error = true;
|
||||
}
|
||||
} else {
|
||||
removes.add(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME);
|
||||
if ("false".equals(_ntcpAutoIP))
|
||||
addFormNotice(_("Disabling inbound TCP"));
|
||||
addFormNotice(_t("Disabling inbound TCP"));
|
||||
else
|
||||
addFormNotice(_("Updating inbound TCP address to auto")); // true or always
|
||||
addFormNotice(_t("Updating inbound TCP address to auto")); // true or always
|
||||
}
|
||||
if (valid) {
|
||||
changes.put(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_IP, _ntcpAutoIP);
|
||||
@@ -275,18 +275,18 @@ public class ConfigNetHandler extends FormHandler {
|
||||
int port = Addresses.getPort(_ntcpPort);
|
||||
if (port != 0) {
|
||||
changes.put(ConfigNetHelper.PROP_I2NP_NTCP_PORT, _ntcpPort);
|
||||
addFormNotice(_("Updating TCP port to {0}", _ntcpPort));
|
||||
addFormNotice(_t("Updating TCP port to {0}", _ntcpPort));
|
||||
if (port < 1024) {
|
||||
addFormError(_("Warning - ports less than 1024 are not recommended"));
|
||||
addFormError(_t("Warning - ports less than 1024 are not recommended"));
|
||||
error = true;
|
||||
}
|
||||
} else {
|
||||
addFormError(_("Invalid port") + ": " + _ntcpPort);
|
||||
addFormError(_t("Invalid port") + ": " + _ntcpPort);
|
||||
error = true;
|
||||
}
|
||||
} else {
|
||||
removes.add(ConfigNetHelper.PROP_I2NP_NTCP_PORT);
|
||||
addFormNotice(_("Updating inbound TCP port to auto"));
|
||||
addFormNotice(_t("Updating inbound TCP port to auto"));
|
||||
}
|
||||
changes.put(ConfigNetHelper.PROP_I2NP_NTCP_AUTO_PORT, "" + _ntcpAutoPort);
|
||||
restartRequired = true;
|
||||
@@ -300,15 +300,15 @@ public class ConfigNetHandler extends FormHandler {
|
||||
if (port != 0) {
|
||||
changes.put(UDPTransport.PROP_INTERNAL_PORT, _udpPort);
|
||||
changes.put(UDPTransport.PROP_EXTERNAL_PORT, _udpPort);
|
||||
addFormNotice(_("Updating UDP port to {0}", _udpPort));
|
||||
addFormNotice(_t("Updating UDP port to {0}", _udpPort));
|
||||
if (port < 1024) {
|
||||
addFormError(_("Warning - ports less than 1024 are not recommended"));
|
||||
addFormError(_t("Warning - ports less than 1024 are not recommended"));
|
||||
error = true;
|
||||
} else {
|
||||
restartRequired = true;
|
||||
}
|
||||
} else {
|
||||
addFormError(_("Invalid port") + ": " + _udpPort);
|
||||
addFormError(_t("Invalid port") + ": " + _udpPort);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
@@ -325,9 +325,9 @@ public class ConfigNetHandler extends FormHandler {
|
||||
if (switchRequired) {
|
||||
changes.put(PROP_HIDDEN, "" + _hiddenMode);
|
||||
if (_hiddenMode)
|
||||
addFormError(_("Gracefully restarting into Hidden Router Mode"));
|
||||
addFormError(_t("Gracefully restarting into Hidden Router Mode"));
|
||||
else
|
||||
addFormError(_("Gracefully restarting to exit Hidden Router Mode"));
|
||||
addFormError(_t("Gracefully restarting to exit Hidden Router Mode"));
|
||||
}
|
||||
|
||||
changes.put(Router.PROP_DYNAMIC_KEYS, "" + _dynamicKeys);
|
||||
@@ -336,10 +336,10 @@ public class ConfigNetHandler extends FormHandler {
|
||||
_upnp) {
|
||||
// This is minor, don't set restartRequired
|
||||
if (_upnp)
|
||||
addFormNotice(_("Enabling UPnP"));
|
||||
addFormNotice(_t("Enabling UPnP"));
|
||||
else
|
||||
addFormNotice(_("Disabling UPnP"));
|
||||
addFormNotice(_("Restart required to take effect"));
|
||||
addFormNotice(_t("Disabling UPnP"));
|
||||
addFormNotice(_t("Restart required to take effect"));
|
||||
}
|
||||
changes.put(TransportManager.PROP_ENABLE_UPNP, "" + _upnp);
|
||||
|
||||
@@ -347,18 +347,18 @@ public class ConfigNetHandler extends FormHandler {
|
||||
_laptop) {
|
||||
// This is minor, don't set restartRequired
|
||||
if (_laptop)
|
||||
addFormNotice(_("Enabling laptop mode"));
|
||||
addFormNotice(_t("Enabling laptop mode"));
|
||||
else
|
||||
addFormNotice(_("Disabling laptop mode"));
|
||||
addFormNotice(_t("Disabling laptop mode"));
|
||||
}
|
||||
changes.put(UDPTransport.PROP_LAPTOP_MODE, "" + _laptop);
|
||||
|
||||
if (Boolean.parseBoolean(_context.getProperty(TransportUtil.PROP_IPV4_FIREWALLED)) !=
|
||||
_ipv4Firewalled) {
|
||||
if (_ipv4Firewalled)
|
||||
addFormNotice(_("Disabling inbound IPv4"));
|
||||
addFormNotice(_t("Disabling inbound IPv4"));
|
||||
else
|
||||
addFormNotice(_("Enabling inbound IPv4"));
|
||||
addFormNotice(_t("Enabling inbound IPv4"));
|
||||
restartRequired = true;
|
||||
}
|
||||
changes.put(TransportUtil.PROP_IPV4_FIREWALLED, "" + _ipv4Firewalled);
|
||||
@@ -366,16 +366,16 @@ public class ConfigNetHandler extends FormHandler {
|
||||
if (_context.getBooleanPropertyDefaultTrue(TransportManager.PROP_ENABLE_UDP) !=
|
||||
!_udpDisabled) {
|
||||
if (_udpDisabled)
|
||||
addFormNotice(_("Disabling UDP"));
|
||||
addFormNotice(_t("Disabling UDP"));
|
||||
else
|
||||
addFormNotice(_("Enabling UDP"));
|
||||
addFormNotice(_t("Enabling UDP"));
|
||||
restartRequired = true;
|
||||
}
|
||||
changes.put(TransportManager.PROP_ENABLE_UDP, "" + (!_udpDisabled));
|
||||
|
||||
if (_requireIntroductions) {
|
||||
changes.put(UDPTransport.PROP_FORCE_INTRODUCERS, "true");
|
||||
addFormNotice(_("Requiring SSU introducers"));
|
||||
addFormNotice(_t("Requiring SSU introducers"));
|
||||
} else {
|
||||
removes.add(UDPTransport.PROP_FORCE_INTRODUCERS);
|
||||
}
|
||||
@@ -386,9 +386,9 @@ public class ConfigNetHandler extends FormHandler {
|
||||
|
||||
boolean saved = _context.router().saveConfig(changes, removes);
|
||||
if (saved)
|
||||
addFormNotice(_("Configuration saved successfully"));
|
||||
addFormNotice(_t("Configuration saved successfully"));
|
||||
else
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
|
||||
// this has to be after the save
|
||||
if (ratesUpdated)
|
||||
@@ -416,7 +416,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
//} else {
|
||||
// There's a few changes that don't really require restart (e.g. enabling inbound TCP)
|
||||
// But it would be hard to get right, so just do a restart.
|
||||
//addFormError(_("Gracefully restarting I2P to change published router address"));
|
||||
//addFormError(_t("Gracefully restarting I2P to change published router address"));
|
||||
//_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
|
||||
//}
|
||||
}
|
||||
@@ -433,13 +433,13 @@ public class ConfigNetHandler extends FormHandler {
|
||||
return false;
|
||||
byte[] iab = Addresses.getIP(addr);
|
||||
if (iab == null) {
|
||||
addFormError(_("Invalid address") + ": " + addr);
|
||||
addFormError(_t("Invalid address") + ": " + addr);
|
||||
return false;
|
||||
}
|
||||
// TODO set IPv6 arg based on configuration?
|
||||
boolean rv = TransportUtil.isPubliclyRoutable(iab, true);
|
||||
if (!rv)
|
||||
addFormError(_("The hostname or IP {0} is not publicly routable", addr));
|
||||
addFormError(_t("The hostname or IP {0} is not publicly routable", addr));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -464,7 +464,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
String old = _context.router().getConfigSetting(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE);
|
||||
if ( (old == null) || (!old.equals(_sharePct)) ) {
|
||||
changes.put(Router.PROP_BANDWIDTH_SHARE_PERCENTAGE, _sharePct);
|
||||
addFormNotice(_("Updating bandwidth share percentage"));
|
||||
addFormNotice(_t("Updating bandwidth share percentage"));
|
||||
updated = true;
|
||||
}
|
||||
}
|
||||
@@ -494,7 +494,7 @@ public class ConfigNetHandler extends FormHandler {
|
||||
}
|
||||
|
||||
if (bwUpdated) {
|
||||
addFormNotice(_("Updated bandwidth limits"));
|
||||
addFormNotice(_t("Updated bandwidth limits"));
|
||||
updated = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,10 +43,10 @@ public class ConfigNetHelper extends HelperBase {
|
||||
public String getUdpIP() {
|
||||
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
|
||||
if (addr == null)
|
||||
return _("unknown");
|
||||
return _t("unknown");
|
||||
String rv = addr.getHost();
|
||||
if (rv == null)
|
||||
return _("unknown");
|
||||
return _t("unknown");
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ public class ConfigNetHelper extends HelperBase {
|
||||
/****
|
||||
RouterAddress addr = _context.router().getRouterInfo().getTargetAddress("SSU");
|
||||
if (addr == null)
|
||||
return _("unknown");
|
||||
return _t("unknown");
|
||||
UDPAddress ua = new UDPAddress(addr);
|
||||
if (ua.getPort() <= 0)
|
||||
return _("unknown");
|
||||
return _t("unknown");
|
||||
return "" + ua.getPort();
|
||||
****/
|
||||
// Since we can't get to UDPTransport.getRequestedPort() from here, just use
|
||||
@@ -253,8 +253,8 @@ public class ConfigNetHelper extends HelperBase {
|
||||
return kbytesToBits(getShareBandwidth());
|
||||
}
|
||||
private String kbytesToBits(int kbytes) {
|
||||
return DataHelper.formatSize(kbytes * (8 * 1024L)) + ' ' + _("bits per second") +
|
||||
' ' + _("or {0} bytes per month maximum", DataHelper.formatSize(kbytes * (1024L * 60 * 60 * 24 * 31)));
|
||||
return DataHelper.formatSize(kbytes * (8 * 1024L)) + ' ' + _t("bits per second") +
|
||||
' ' + _t("or {0} bytes per month maximum", DataHelper.formatSize(kbytes * (1024L * 60 * 60 * 24 * 31)));
|
||||
}
|
||||
public String getInboundBurstRate() {
|
||||
return "" + _context.bandwidthLimiter().getInboundBurstKBytesPerSecond();
|
||||
|
||||
@@ -17,26 +17,26 @@ public class ConfigPeerHandler extends FormHandler {
|
||||
if ("Save Configuration".equals(_action)) {
|
||||
_context.router().saveConfig();
|
||||
addFormNotice("Settings saved - not really!!!!!");
|
||||
} else if (_action.equals(_("Ban peer until restart"))) {
|
||||
} else if (_action.equals(_t("Ban peer until restart"))) {
|
||||
Hash h = getHash();
|
||||
if (h != null) {
|
||||
_context.banlist().banlistRouterForever(h, _("Manually banned via {0}"), "<a href=\"configpeer\">configpeer</a>");
|
||||
addFormNotice(_("Peer") + " " + _peer + " " + _("banned until restart") );
|
||||
_context.banlist().banlistRouterForever(h, _t("Manually banned via {0}"), "<a href=\"configpeer\">configpeer</a>");
|
||||
addFormNotice(_t("Peer") + " " + _peer + " " + _t("banned until restart") );
|
||||
return;
|
||||
}
|
||||
addFormError(_("Invalid peer"));
|
||||
} else if (_action.equals(_("Unban peer"))) {
|
||||
addFormError(_t("Invalid peer"));
|
||||
} else if (_action.equals(_t("Unban peer"))) {
|
||||
Hash h = getHash();
|
||||
if (h != null) {
|
||||
if (_context.banlist().isBanlisted(h)) {
|
||||
_context.banlist().unbanlistRouter(h);
|
||||
addFormNotice(_("Peer") + " " + _peer + " " + _("unbanned") );
|
||||
addFormNotice(_t("Peer") + " " + _peer + " " + _t("unbanned") );
|
||||
} else
|
||||
addFormNotice(_("Peer") + " " + _peer + " " + _("is not currently banned") );
|
||||
addFormNotice(_t("Peer") + " " + _peer + " " + _t("is not currently banned") );
|
||||
return;
|
||||
}
|
||||
addFormError(_("Invalid peer"));
|
||||
} else if (_action.equals(_("Adjust peer bonuses"))) {
|
||||
addFormError(_t("Invalid peer"));
|
||||
} else if (_action.equals(_t("Adjust peer bonuses"))) {
|
||||
Hash h = getHash();
|
||||
if (h != null) {
|
||||
PeerProfile prof = _context.profileOrganizer().getProfile(h);
|
||||
@@ -44,23 +44,23 @@ public class ConfigPeerHandler extends FormHandler {
|
||||
try {
|
||||
prof.setSpeedBonus(Long.parseLong(_speed));
|
||||
} catch (NumberFormatException nfe) {
|
||||
addFormError(_("Bad speed value"));
|
||||
addFormError(_t("Bad speed value"));
|
||||
}
|
||||
try {
|
||||
prof.setCapacityBonus(Long.parseLong(_capacity));
|
||||
} catch (NumberFormatException nfe) {
|
||||
addFormError(_("Bad capacity value"));
|
||||
addFormError(_t("Bad capacity value"));
|
||||
}
|
||||
addFormNotice("Bonuses adjusted for " + _peer);
|
||||
} else
|
||||
addFormError("No profile exists for " + _peer);
|
||||
return;
|
||||
}
|
||||
addFormError(_("Invalid peer"));
|
||||
addFormError(_t("Invalid peer"));
|
||||
} else if (_action.startsWith("Check")) {
|
||||
addFormError(_("Unsupported"));
|
||||
addFormError(_t("Unsupported"));
|
||||
} else {
|
||||
//addFormError(_("Unsupported") + ' ' + _action + '.');
|
||||
//addFormError(_t("Unsupported") + ' ' + _action + '.');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,32 +21,32 @@ public class ConfigReseedHandler extends FormHandler {
|
||||
@Override
|
||||
protected void processForm() {
|
||||
|
||||
if (_action.equals(_("Save changes and reseed now"))) {
|
||||
if (_action.equals(_t("Save changes and reseed now"))) {
|
||||
saveChanges();
|
||||
if (!_context.netDb().reseedChecker().requestReseed()) {
|
||||
addFormError(_("Reseeding is already in progress"));
|
||||
addFormError(_t("Reseeding is already in progress"));
|
||||
} else {
|
||||
// skip the nonce checking in ReseedHandler
|
||||
addFormNotice(_("Starting reseed process"));
|
||||
addFormNotice(_t("Starting reseed process"));
|
||||
}
|
||||
} else if (_action.equals(_("Reseed from URL"))) {
|
||||
} else if (_action.equals(_t("Reseed from URL"))) {
|
||||
String val = getJettyString("url");
|
||||
if (val != null)
|
||||
val = val.trim();
|
||||
if (val == null || val.length() == 0) {
|
||||
addFormError(_("You must enter a URL"));
|
||||
addFormError(_t("You must enter a URL"));
|
||||
return;
|
||||
}
|
||||
URL url;
|
||||
try {
|
||||
url = new URL(val);
|
||||
} catch (MalformedURLException mue) {
|
||||
addFormError(_("Bad URL {0}", val));
|
||||
addFormError(_t("Bad URL {0}", val));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if (!_context.netDb().reseedChecker().requestReseed(url)) {
|
||||
addFormError(_("Reseeding is already in progress"));
|
||||
addFormError(_t("Reseeding is already in progress"));
|
||||
} else {
|
||||
// wait a while for completion but not forever
|
||||
for (int i = 0; i < 40; i++) {
|
||||
@@ -63,50 +63,50 @@ public class ConfigReseedHandler extends FormHandler {
|
||||
} else if (status.length() > 0) {
|
||||
addFormNoticeNoEscape(status);
|
||||
} else if (_context.netDb().reseedChecker().inProgress()) {
|
||||
addFormNotice(_("Reseed in progress, check summary bar for status"));
|
||||
addFormNotice(_t("Reseed in progress, check summary bar for status"));
|
||||
} else {
|
||||
addFormNotice(_("Reseed complete, check summary bar for status"));
|
||||
addFormNotice(_t("Reseed complete, check summary bar for status"));
|
||||
}
|
||||
}
|
||||
} catch (IllegalArgumentException iae) {
|
||||
addFormError(_("Bad URL {0}", val) + " - " + iae.getMessage());
|
||||
addFormError(_t("Bad URL {0}", val) + " - " + iae.getMessage());
|
||||
}
|
||||
} else if (_action.equals(_("Reseed from file"))) {
|
||||
} else if (_action.equals(_t("Reseed from file"))) {
|
||||
InputStream in = _requestWrapper.getInputStream("file");
|
||||
try {
|
||||
// non-null but zero bytes if no file entered, don't know why
|
||||
if (in == null || in.available() <= 0) {
|
||||
addFormError(_("You must enter a file"));
|
||||
addFormError(_t("You must enter a file"));
|
||||
return;
|
||||
}
|
||||
int count = _context.netDb().reseedChecker().requestReseed(in);
|
||||
if (count <= 0) {
|
||||
addFormError(_("Reseed from file failed"));
|
||||
addFormError(_t("Reseed from file failed"));
|
||||
} else {
|
||||
addFormNotice(ngettext("Reseed successful, loaded {0} router info from file",
|
||||
"Reseed successful, loaded {0} router infos from file",
|
||||
count));
|
||||
}
|
||||
} catch (IOException ioe) {
|
||||
addFormError(_("Reseed from file failed") + " - " + ioe);
|
||||
addFormError(_t("Reseed from file failed") + " - " + ioe);
|
||||
} finally {
|
||||
// it's really a ByteArrayInputStream but we'll play along...
|
||||
if (in != null)
|
||||
try { in.close(); } catch (IOException ioe) {}
|
||||
}
|
||||
} else if (_action.equals(_("Save changes"))) {
|
||||
} else if (_action.equals(_t("Save changes"))) {
|
||||
saveChanges();
|
||||
} else if (_action.equals(_("Reset URL list"))) {
|
||||
} else if (_action.equals(_t("Reset URL list"))) {
|
||||
resetUrlList();
|
||||
}
|
||||
//addFormError(_("Unsupported") + ' ' + _action + '.');
|
||||
//addFormError(_t("Unsupported") + ' ' + _action + '.');
|
||||
}
|
||||
|
||||
private void resetUrlList() {
|
||||
if (_context.router().saveConfig(Reseeder.PROP_RESEED_URL, null))
|
||||
addFormNotice(_("URL list reset successfully"));
|
||||
addFormNotice(_t("URL list reset successfully"));
|
||||
else
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
}
|
||||
|
||||
/** @since 0.8.9 */
|
||||
@@ -155,9 +155,9 @@ public class ConfigReseedHandler extends FormHandler {
|
||||
saveBoolean(Reseeder.PROP_PROXY_ENABLE, "enable");
|
||||
saveBoolean(Reseeder.PROP_SPROXY_ENABLE, "senable");
|
||||
if (_context.router().saveConfig(changes, removes))
|
||||
addFormNotice(_("Configuration saved successfully."));
|
||||
addFormNotice(_t("Configuration saved successfully."));
|
||||
else
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs"));
|
||||
}
|
||||
|
||||
/** translate (ngettext) @since 0.9.19 */
|
||||
|
||||
@@ -31,24 +31,24 @@ public class ConfigRestartBean {
|
||||
String systemNonce = getNonce();
|
||||
if ( (nonce != null) && (systemNonce.equals(nonce)) && (action != null) ) {
|
||||
// Normal browsers send value, IE sends button label
|
||||
if ("shutdownImmediate".equals(action) || _("Shutdown immediately", ctx).equals(action)) {
|
||||
if ("shutdownImmediate".equals(action) || _t("Shutdown immediately", ctx).equals(action)) {
|
||||
if (ctx.hasWrapper())
|
||||
ConfigServiceHandler.registerWrapperNotifier(ctx, Router.EXIT_HARD, false);
|
||||
//ctx.router().shutdown(Router.EXIT_HARD); // never returns
|
||||
ctx.router().shutdownGracefully(Router.EXIT_HARD); // give the UI time to respond
|
||||
} else if ("cancelShutdown".equals(action) || _("Cancel shutdown", ctx).equals(action) ||
|
||||
_("Cancel restart", ctx).equals(action)) {
|
||||
} else if ("cancelShutdown".equals(action) || _t("Cancel shutdown", ctx).equals(action) ||
|
||||
_t("Cancel restart", ctx).equals(action)) {
|
||||
ctx.router().cancelGracefulShutdown();
|
||||
} else if ("restartImmediate".equals(action) || _("Restart immediately", ctx).equals(action)) {
|
||||
} else if ("restartImmediate".equals(action) || _t("Restart immediately", ctx).equals(action)) {
|
||||
if (ctx.hasWrapper())
|
||||
ConfigServiceHandler.registerWrapperNotifier(ctx, Router.EXIT_HARD_RESTART, false);
|
||||
//ctx.router().shutdown(Router.EXIT_HARD_RESTART); // never returns
|
||||
ctx.router().shutdownGracefully(Router.EXIT_HARD_RESTART); // give the UI time to respond
|
||||
} else if ("restart".equals(action) || _("Restart", ctx).equals(action)) {
|
||||
} else if ("restart".equals(action) || _t("Restart", ctx).equals(action)) {
|
||||
if (ctx.hasWrapper())
|
||||
ConfigServiceHandler.registerWrapperNotifier(ctx, Router.EXIT_GRACEFUL_RESTART, false);
|
||||
ctx.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
|
||||
} else if ("shutdown".equals(action) || _("Shutdown", ctx).equals(action)) {
|
||||
} else if ("shutdown".equals(action) || _t("Shutdown", ctx).equals(action)) {
|
||||
if (ctx.hasWrapper())
|
||||
ConfigServiceHandler.registerWrapperNotifier(ctx, Router.EXIT_GRACEFUL, false);
|
||||
ctx.router().shutdownGracefully();
|
||||
@@ -62,13 +62,13 @@ public class ConfigRestartBean {
|
||||
if ((shuttingDown || restarting) && timeRemaining <= 5*1000) {
|
||||
buf.append("<h4>");
|
||||
if (restarting)
|
||||
buf.append(_("Restart imminent", ctx));
|
||||
buf.append(_t("Restart imminent", ctx));
|
||||
else
|
||||
buf.append(_("Shutdown imminent", ctx));
|
||||
buf.append(_t("Shutdown imminent", ctx));
|
||||
buf.append("</h4>");
|
||||
} else if (shuttingDown) {
|
||||
buf.append("<h4>");
|
||||
buf.append(_("Shutdown in {0}", DataHelper.formatDuration2(timeRemaining), ctx));
|
||||
buf.append(_t("Shutdown in {0}", DataHelper.formatDuration2(timeRemaining), ctx));
|
||||
int tuns = ctx.tunnelManager().getParticipatingCount();
|
||||
if (tuns > 0) {
|
||||
buf.append("<br>").append(ngettext("Please wait for routing commitment to expire for {0} tunnel",
|
||||
@@ -79,7 +79,7 @@ public class ConfigRestartBean {
|
||||
buttons(ctx, buf, urlBase, systemNonce, SET1);
|
||||
} else if (restarting) {
|
||||
buf.append("<h4>");
|
||||
buf.append(_("Restart in {0}", DataHelper.formatDuration2(timeRemaining), ctx));
|
||||
buf.append(_t("Restart in {0}", DataHelper.formatDuration2(timeRemaining), ctx));
|
||||
int tuns = ctx.tunnelManager().getParticipatingCount();
|
||||
if (tuns > 0) {
|
||||
buf.append("<br>").append(ngettext("Please wait for routing commitment to expire for {0} tunnel",
|
||||
@@ -105,7 +105,7 @@ public class ConfigRestartBean {
|
||||
buf.append("<button type=\"submit\" name=\"action\" value=\"")
|
||||
.append(s[i]).append("\" class=\"")
|
||||
.append(s[i+1]).append("\" >")
|
||||
.append(_(s[i+2], ctx)).append("</button>\n");
|
||||
.append(_t(s[i+2], ctx)).append("</button>\n");
|
||||
}
|
||||
buf.append("</form>\n");
|
||||
}
|
||||
@@ -126,11 +126,11 @@ public class ConfigRestartBean {
|
||||
return Long.MAX_VALUE/2; // summaryframe.jsp adds a safety factor so we don't want to overflow...
|
||||
}
|
||||
|
||||
private static String _(String s, RouterContext ctx) {
|
||||
private static String _t(String s, RouterContext ctx) {
|
||||
return Messages.getString(s, ctx);
|
||||
}
|
||||
|
||||
private static String _(String s, Object o, RouterContext ctx) {
|
||||
private static String _t(String s, Object o, RouterContext ctx) {
|
||||
return Messages.getString(s, o, ctx);
|
||||
}
|
||||
|
||||
|
||||
@@ -196,60 +196,60 @@ public class ConfigServiceHandler extends FormHandler {
|
||||
protected void processForm() {
|
||||
if (_action == null) return;
|
||||
|
||||
if (_("Shutdown gracefully").equals(_action)) {
|
||||
if (_t("Shutdown gracefully").equals(_action)) {
|
||||
if (_context.hasWrapper())
|
||||
registerWrapperNotifier(Router.EXIT_GRACEFUL, false);
|
||||
_context.router().shutdownGracefully();
|
||||
addFormNotice(_("Graceful shutdown initiated"));
|
||||
} else if (_("Shutdown immediately").equals(_action)) {
|
||||
addFormNotice(_t("Graceful shutdown initiated"));
|
||||
} else if (_t("Shutdown immediately").equals(_action)) {
|
||||
if (_context.hasWrapper())
|
||||
registerWrapperNotifier(Router.EXIT_HARD, false);
|
||||
_context.router().shutdown(Router.EXIT_HARD);
|
||||
addFormNotice(_("Shutdown immediately"));
|
||||
} else if (_("Cancel graceful shutdown").equals(_action)) {
|
||||
addFormNotice(_t("Shutdown immediately"));
|
||||
} else if (_t("Cancel graceful shutdown").equals(_action)) {
|
||||
_context.router().cancelGracefulShutdown();
|
||||
addFormNotice(_("Graceful shutdown cancelled"));
|
||||
} else if (_("Graceful restart").equals(_action)) {
|
||||
addFormNotice(_t("Graceful shutdown cancelled"));
|
||||
} else if (_t("Graceful restart").equals(_action)) {
|
||||
// should have wrapper if restart button is visible
|
||||
if (_context.hasWrapper())
|
||||
registerWrapperNotifier(Router.EXIT_GRACEFUL_RESTART, false);
|
||||
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
|
||||
addFormNotice(_("Graceful restart requested"));
|
||||
} else if (_("Hard restart").equals(_action)) {
|
||||
addFormNotice(_t("Graceful restart requested"));
|
||||
} else if (_t("Hard restart").equals(_action)) {
|
||||
// should have wrapper if restart button is visible
|
||||
if (_context.hasWrapper())
|
||||
registerWrapperNotifier(Router.EXIT_HARD_RESTART, false);
|
||||
_context.router().shutdown(Router.EXIT_HARD_RESTART);
|
||||
addFormNotice(_("Hard restart requested"));
|
||||
} else if (_("Rekey and Restart").equals(_action)) {
|
||||
addFormNotice(_("Rekeying after graceful restart"));
|
||||
addFormNotice(_t("Hard restart requested"));
|
||||
} else if (_t("Rekey and Restart").equals(_action)) {
|
||||
addFormNotice(_t("Rekeying after graceful restart"));
|
||||
registerWrapperNotifier(Router.EXIT_GRACEFUL_RESTART, true);
|
||||
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL_RESTART);
|
||||
} else if (_("Rekey and Shutdown").equals(_action)) {
|
||||
addFormNotice(_("Rekeying after graceful shutdown"));
|
||||
} else if (_t("Rekey and Shutdown").equals(_action)) {
|
||||
addFormNotice(_t("Rekeying after graceful shutdown"));
|
||||
registerWrapperNotifier(Router.EXIT_GRACEFUL, true);
|
||||
_context.router().shutdownGracefully(Router.EXIT_GRACEFUL);
|
||||
} else if (_("Run I2P on startup").equals(_action)) {
|
||||
} else if (_t("Run I2P on startup").equals(_action)) {
|
||||
installService();
|
||||
} else if (_("Don't run I2P on startup").equals(_action)) {
|
||||
} else if (_t("Don't run I2P on startup").equals(_action)) {
|
||||
uninstallService();
|
||||
} else if (_("Dump threads").equals(_action)) {
|
||||
} else if (_t("Dump threads").equals(_action)) {
|
||||
try {
|
||||
WrapperManager.requestThreadDump();
|
||||
} catch (Throwable t) {
|
||||
addFormError("Warning: unable to contact the service manager - " + t.getMessage());
|
||||
}
|
||||
File wlog = LogsHelper.wrapperLogFile(_context);
|
||||
addFormNotice(_("Threads dumped to {0}", wlog.getAbsolutePath()));
|
||||
} else if (_("View console on startup").equals(_action)) {
|
||||
addFormNotice(_t("Threads dumped to {0}", wlog.getAbsolutePath()));
|
||||
} else if (_t("View console on startup").equals(_action)) {
|
||||
browseOnStartup(true);
|
||||
addFormNotice(_("Console is to be shown on startup"));
|
||||
} else if (_("Do not view console on startup").equals(_action)) {
|
||||
addFormNotice(_t("Console is to be shown on startup"));
|
||||
} else if (_t("Do not view console on startup").equals(_action)) {
|
||||
browseOnStartup(false);
|
||||
addFormNotice(_("Console is not to be shown on startup"));
|
||||
} else if (_("Force GC").equals(_action)) {
|
||||
addFormNotice(_t("Console is not to be shown on startup"));
|
||||
} else if (_t("Force GC").equals(_action)) {
|
||||
Runtime.getRuntime().gc();
|
||||
addFormNotice(_("Full garbage collection requested"));
|
||||
addFormNotice(_t("Full garbage collection requested"));
|
||||
} else {
|
||||
//addFormNotice("Blah blah blah. whatever. I'm not going to " + _action);
|
||||
}
|
||||
@@ -258,18 +258,18 @@ public class ConfigServiceHandler extends FormHandler {
|
||||
private void installService() {
|
||||
try {
|
||||
Runtime.getRuntime().exec("install_i2p_service_winnt.bat");
|
||||
addFormNotice(_("Service installed"));
|
||||
addFormNotice(_t("Service installed"));
|
||||
} catch (IOException ioe) {
|
||||
addFormError(_("Warning: unable to install the service") + " - " + ioe.getMessage());
|
||||
addFormError(_t("Warning: unable to install the service") + " - " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void uninstallService() {
|
||||
try {
|
||||
Runtime.getRuntime().exec("uninstall_i2p_service_winnt.bat");
|
||||
addFormNotice(_("Service removed"));
|
||||
addFormNotice(_t("Service removed"));
|
||||
} catch (IOException ioe) {
|
||||
addFormError(_("Warning: unable to remove the service") + " - " + ioe.getMessage());
|
||||
addFormError(_t("Warning: unable to remove the service") + " - " + ioe.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,16 +113,16 @@ public class ConfigStatsHandler extends FormHandler {
|
||||
changes.put(StatManager.PROP_STAT_FULL, "" + _isFull);
|
||||
_context.router().saveConfig(changes, null);
|
||||
if (!_stats.isEmpty())
|
||||
addFormNotice(_("Stat filter and location updated successfully to") + ": " + stats.toString());
|
||||
addFormNotice(_t("Stat filter and location updated successfully to") + ": " + stats.toString());
|
||||
if (fullChanged) {
|
||||
if (_isFull)
|
||||
addFormNotice(_("Full statistics enabled"));
|
||||
addFormNotice(_t("Full statistics enabled"));
|
||||
else
|
||||
addFormNotice(_("Full statistics disabled"));
|
||||
addFormNotice(_("Restart required to take effect"));
|
||||
addFormNotice(_t("Full statistics disabled"));
|
||||
addFormNotice(_t("Restart required to take effect"));
|
||||
}
|
||||
if (graphsChanged)
|
||||
addFormNoticeNoEscape(_("Graph list updated, may take up to 60s to be reflected on the {0}Graphs Page{1}", "<a href=\"graphs\">", "</a>"));
|
||||
addFormNoticeNoEscape(_t("Graph list updated, may take up to 60s to be reflected on the {0}Graphs Page{1}", "<a href=\"graphs\">", "</a>"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -176,8 +176,8 @@ public class ConfigStatsHelper extends HelperBase {
|
||||
*/
|
||||
private class AlphaComparator implements Comparator<String> {
|
||||
public int compare(String lhs, String rhs) {
|
||||
String lname = _(lhs);
|
||||
String rname = _(rhs);
|
||||
String lname = _t(lhs);
|
||||
String rname = _t(rhs);
|
||||
return Collator.getInstance().compare(lname, rname);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,30 +19,30 @@ public class ConfigSummaryHandler extends FormHandler {
|
||||
protected void processForm() {
|
||||
if (_action == null) return;
|
||||
String group = getJettyString("group");
|
||||
boolean deleting = _action.equals(_("Delete selected"));
|
||||
boolean adding = _action.equals(_("Add item"));
|
||||
boolean saving = _action.equals(_("Save order"));
|
||||
boolean deleting = _action.equals(_t("Delete selected"));
|
||||
boolean adding = _action.equals(_t("Add item"));
|
||||
boolean saving = _action.equals(_t("Save order"));
|
||||
boolean moving = _action.startsWith("move_");
|
||||
if (_action.equals(_("Save")) && "0".equals(group)) {
|
||||
if (_action.equals(_t("Save")) && "0".equals(group)) {
|
||||
try {
|
||||
int refreshInterval = Integer.parseInt(getJettyString("refreshInterval"));
|
||||
if (refreshInterval >= CSSHelper.MIN_REFRESH) {
|
||||
_context.router().saveConfig(CSSHelper.PROP_REFRESH, "" + refreshInterval);
|
||||
addFormNotice(_("Refresh interval changed"));
|
||||
addFormNotice(_t("Refresh interval changed"));
|
||||
} else
|
||||
addFormError(_("Refresh interval must be at least {0} seconds", CSSHelper.MIN_REFRESH));
|
||||
addFormError(_t("Refresh interval must be at least {0} seconds", CSSHelper.MIN_REFRESH));
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
addFormError(_("Refresh interval must be a number"));
|
||||
addFormError(_t("Refresh interval must be a number"));
|
||||
return;
|
||||
}
|
||||
} else if (_action.equals(_("Restore full default"))) {
|
||||
} else if (_action.equals(_t("Restore full default"))) {
|
||||
_context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_FULL);
|
||||
addFormNotice(_("Full summary bar default restored.") + " " +
|
||||
_("Summary bar will refresh shortly."));
|
||||
} else if (_action.equals(_("Restore minimal default"))) {
|
||||
addFormNotice(_t("Full summary bar default restored.") + " " +
|
||||
_t("Summary bar will refresh shortly."));
|
||||
} else if (_action.equals(_t("Restore minimal default"))) {
|
||||
_context.router().saveConfig(SummaryHelper.PROP_SUMMARYBAR + "default", SummaryHelper.DEFAULT_MINIMAL);
|
||||
addFormNotice(_("Minimal summary bar default restored.") + " " +
|
||||
_("Summary bar will refresh shortly."));
|
||||
addFormNotice(_t("Minimal summary bar default restored.") + " " +
|
||||
_t("Summary bar will refresh shortly."));
|
||||
} else if (adding || deleting || saving || moving) {
|
||||
Map<Integer, String> sections = new TreeMap<Integer, String>();
|
||||
for (Object o : _settings.keySet()) {
|
||||
@@ -58,19 +58,19 @@ public class ConfigSummaryHandler extends FormHandler {
|
||||
int order = Integer.parseInt(v);
|
||||
sections.put(order, k);
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
addFormError(_("Order must be an integer"));
|
||||
addFormError(_t("Order must be an integer"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (adding) {
|
||||
String name = getJettyString("name");
|
||||
if (name == null || name.length() <= 0) {
|
||||
addFormError(_("No section selected"));
|
||||
addFormError(_t("No section selected"));
|
||||
return;
|
||||
}
|
||||
String order = getJettyString("order");
|
||||
if (order == null || order.length() <= 0) {
|
||||
addFormError(_("No order entered"));
|
||||
addFormError(_t("No order entered"));
|
||||
return;
|
||||
}
|
||||
name = DataHelper.escapeHTML(name).replace(",", ",");
|
||||
@@ -78,9 +78,9 @@ public class ConfigSummaryHandler extends FormHandler {
|
||||
try {
|
||||
int ki = Integer.parseInt(order);
|
||||
sections.put(ki, name);
|
||||
addFormNotice(_("Added") + ": " + name);
|
||||
addFormNotice(_t("Added") + ": " + name);
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
addFormError(_("Order must be an integer"));
|
||||
addFormError(_t("Order must be an integer"));
|
||||
return;
|
||||
}
|
||||
} else if (deleting) {
|
||||
@@ -104,7 +104,7 @@ public class ConfigSummaryHandler extends FormHandler {
|
||||
if (toDelete.contains(i)) {
|
||||
String removedName = sections.get(i);
|
||||
iter.remove();
|
||||
addFormNotice(_("Removed") + ": " + removedName);
|
||||
addFormNotice(_t("Removed") + ": " + removedName);
|
||||
}
|
||||
}
|
||||
} else if (moving) {
|
||||
@@ -126,17 +126,17 @@ public class ConfigSummaryHandler extends FormHandler {
|
||||
sections.put(i + n, sections.get(i));
|
||||
sections.put(i, temp);
|
||||
}
|
||||
addFormNotice(_("Moved") + ": " + sections.get(to));
|
||||
addFormNotice(_t("Moved") + ": " + sections.get(to));
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
addFormError(_("Order must be an integer"));
|
||||
addFormError(_t("Order must be an integer"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
SummaryHelper.saveSummaryBarSections(_context, "default", sections);
|
||||
addFormNotice(_("Saved order of sections.") + " " +
|
||||
_("Summary bar will refresh shortly."));
|
||||
addFormNotice(_t("Saved order of sections.") + " " +
|
||||
_t("Summary bar will refresh shortly."));
|
||||
} else {
|
||||
//addFormError(_("Unsupported"));
|
||||
//addFormError(_t("Unsupported"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class ConfigTunnelsHandler extends FormHandler {
|
||||
}
|
||||
|
||||
public void setShouldsave(String moo) {
|
||||
if ( (moo != null) && (moo.equals(_("Save changes"))) )
|
||||
if ( (moo != null) && (moo.equals(_t("Save changes"))) )
|
||||
_shouldSave = true;
|
||||
}
|
||||
|
||||
@@ -127,14 +127,14 @@ public class ConfigTunnelsHandler extends FormHandler {
|
||||
if (updated > 0)
|
||||
// the count isn't really correct anyway, since we don't check for actual changes
|
||||
//addFormNotice("Updated settings for " + updated + " pools.");
|
||||
addFormNotice(_("Updated settings for all pools."));
|
||||
addFormNotice(_t("Updated settings for all pools."));
|
||||
|
||||
if (saveRequired) {
|
||||
boolean saved = _context.router().saveConfig(changes, null);
|
||||
if (saved)
|
||||
addFormNotice(_("Exploratory tunnel configuration saved successfully."));
|
||||
addFormNotice(_t("Exploratory tunnel configuration saved successfully."));
|
||||
else
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs."));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
TunnelPoolSettings exploratoryIn = _context.tunnelManager().getInboundSettings();
|
||||
TunnelPoolSettings exploratoryOut = _context.tunnelManager().getOutboundSettings();
|
||||
|
||||
renderForm(buf, 0, "exploratory", _("Exploratory tunnels"), exploratoryIn, exploratoryOut);
|
||||
renderForm(buf, 0, "exploratory", _t("Exploratory tunnels"), exploratoryIn, exploratoryOut);
|
||||
|
||||
cur = 1;
|
||||
for (Destination dest : clients) {
|
||||
@@ -46,7 +46,7 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
name = dest.calculateHash().toBase64().substring(0,6);
|
||||
|
||||
String prefix = dest.calculateHash().toBase64().substring(0,4);
|
||||
renderForm(buf, cur, prefix, _("Client tunnels for {0}", DataHelper.escapeHTML(_(name))), in, out);
|
||||
renderForm(buf, cur, prefix, _t("Client tunnels for {0}", DataHelper.escapeHTML(_t(name))), in, out);
|
||||
cur++;
|
||||
}
|
||||
|
||||
@@ -75,26 +75,26 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
in.getLength() + in.getLengthVariance() <= 0 ||
|
||||
out.getLength() <= 0 ||
|
||||
out.getLength() + out.getLengthVariance() <= 0)
|
||||
buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _("ANONYMITY WARNING - Settings include 0-hop tunnels.") + "</font></th></tr>");
|
||||
buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _t("ANONYMITY WARNING - Settings include 0-hop tunnels.") + "</font></th></tr>");
|
||||
else if (in.getLength() <= 1 ||
|
||||
in.getLength() + in.getLengthVariance() <= 1 ||
|
||||
out.getLength() <= 1 ||
|
||||
out.getLength() + out.getLengthVariance() <= 1)
|
||||
buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _("ANONYMITY WARNING - Settings include 1-hop tunnels.") + "</font></th></tr>");
|
||||
buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _t("ANONYMITY WARNING - Settings include 1-hop tunnels.") + "</font></th></tr>");
|
||||
if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH ||
|
||||
out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH)
|
||||
buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _("PERFORMANCE WARNING - Settings include very long tunnels.") + "</font></th></tr>");
|
||||
buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _t("PERFORMANCE WARNING - Settings include very long tunnels.") + "</font></th></tr>");
|
||||
if (in.getTotalQuantity() >= WARN_QUANTITY ||
|
||||
out.getTotalQuantity() >= WARN_QUANTITY)
|
||||
buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _("PERFORMANCE WARNING - Settings include high tunnel quantities.") + "</font></th></tr>");
|
||||
buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _t("PERFORMANCE WARNING - Settings include high tunnel quantities.") + "</font></th></tr>");
|
||||
|
||||
buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt=\"Inbound\" title=\"Inbound Tunnels\"> " + _("Inbound") + "</th><th><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound Tunnels\" title=\"Outbound\"> " + _("Outbound") + "</th></tr>\n");
|
||||
buf.append("<tr><th></th><th><img src=\"/themes/console/images/inbound.png\" alt=\"Inbound\" title=\"Inbound Tunnels\"> " + _t("Inbound") + "</th><th><img src=\"/themes/console/images/outbound.png\" alt=\"Outbound Tunnels\" title=\"Outbound\"> " + _t("Outbound") + "</th></tr>\n");
|
||||
|
||||
// buf.append("<tr><th></th><th>Inbound</th><th>Outbound</th></tr>\n");
|
||||
|
||||
// tunnel depth
|
||||
int maxLength = advanced ? MAX_ADVANCED_LENGTH : MAX_LENGTH;
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Length") + ":</td>\n");
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _t("Length") + ":</td>\n");
|
||||
buf.append("<td align=\"center\"><select name=\"").append(index).append(".depthInbound\">\n");
|
||||
int now = in.getLength();
|
||||
renderOptions(buf, 0, maxLength, now, "", HOP);
|
||||
@@ -111,7 +111,7 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
buf.append("</tr>\n");
|
||||
|
||||
// tunnel depth variance
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Randomization") + ":</td>\n");
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _t("Randomization") + ":</td>\n");
|
||||
buf.append("<td align=\"center\"><select name=\"").append(index).append(".varianceInbound\">\n");
|
||||
now = in.getLengthVariance();
|
||||
renderOptions(buf, 0, 0, now, "", HOP);
|
||||
@@ -136,7 +136,7 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
|
||||
// tunnel quantity
|
||||
int maxQuantity = advanced ? MAX_ADVANCED_QUANTITY : MAX_QUANTITY;
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Quantity") + ":</td>\n");
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _t("Quantity") + ":</td>\n");
|
||||
buf.append("<td align=\"center\"><select name=\"").append(index).append(".quantityInbound\">\n");
|
||||
now = in.getQuantity();
|
||||
renderOptions(buf, 1, maxQuantity, now, "", TUNNEL);
|
||||
@@ -154,7 +154,7 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
|
||||
// tunnel backup quantity
|
||||
int maxBQuantity = advanced ? MAX_ADVANCED_BACKUP_QUANTITY : MAX_BACKUP_QUANTITY;
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Backup quantity") + ":</td>\n");
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _t("Backup quantity") + ":</td>\n");
|
||||
buf.append("<td align=\"center\"><select name=\"").append(index).append(".backupInbound\">\n");
|
||||
now = in.getBackupQuantity();
|
||||
renderOptions(buf, 0, maxBQuantity, now, "", TUNNEL);
|
||||
@@ -176,7 +176,7 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
// And let's not display them at all unless they have contents, which should be rare.
|
||||
Properties props = in.getUnknownOptions();
|
||||
if (!props.isEmpty()) {
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Inbound options") + ":</td>\n" +
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _t("Inbound options") + ":</td>\n" +
|
||||
"<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
|
||||
buf.append(".inboundOptions\" type=\"text\" size=\"32\" disabled=\"disabled\" " +
|
||||
"value=\"");
|
||||
@@ -188,7 +188,7 @@ public class ConfigTunnelsHelper extends HelperBase {
|
||||
}
|
||||
props = out.getUnknownOptions();
|
||||
if (!props.isEmpty()) {
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _("Outbound options") + ":</td>\n" +
|
||||
buf.append("<tr><td align=\"right\" class=\"mediumtags\">" + _t("Outbound options") + ":</td>\n" +
|
||||
"<td colspan=\"2\" align=\"center\"><input name=\"").append(index);
|
||||
buf.append(".outboundOptions\" type=\"text\" size=\"32\" disabled=\"disabled\" " +
|
||||
"value=\"");
|
||||
|
||||
@@ -16,9 +16,9 @@ public class ConfigUIHandler extends FormHandler {
|
||||
protected void processForm() {
|
||||
if (_shouldSave) {
|
||||
saveChanges();
|
||||
} else if (_action.equals(_("Delete selected"))) {
|
||||
} else if (_action.equals(_t("Delete selected"))) {
|
||||
delUser();
|
||||
} else if (_action.equals(_("Add user"))) {
|
||||
} else if (_action.equals(_t("Add user"))) {
|
||||
addUser();
|
||||
}
|
||||
}
|
||||
@@ -60,29 +60,29 @@ public class ConfigUIHandler extends FormHandler {
|
||||
boolean ok = _context.router().saveConfig(changes, removes);
|
||||
if (ok) {
|
||||
if (!oldTheme.equals(_config))
|
||||
addFormNoticeNoEscape(_("Theme change saved.") +
|
||||
addFormNoticeNoEscape(_t("Theme change saved.") +
|
||||
" <a href=\"configui\">" +
|
||||
_("Refresh the page to view.") +
|
||||
_t("Refresh the page to view.") +
|
||||
"</a>");
|
||||
if (oldForceMobileConsole != _forceMobileConsole)
|
||||
addFormNoticeNoEscape(_("Mobile console option saved.") +
|
||||
addFormNoticeNoEscape(_t("Mobile console option saved.") +
|
||||
" <a href=\"configui\">" +
|
||||
_("Refresh the page to view.") +
|
||||
_t("Refresh the page to view.") +
|
||||
"</a>");
|
||||
} else {
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs."));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs."));
|
||||
}
|
||||
}
|
||||
|
||||
private void addUser() {
|
||||
String name = getJettyString("name");
|
||||
if (name == null || name.length() <= 0) {
|
||||
addFormError(_("No user name entered"));
|
||||
addFormError(_t("No user name entered"));
|
||||
return;
|
||||
}
|
||||
String pw = getJettyString("nofilter_pw");
|
||||
if (pw == null || pw.length() <= 0) {
|
||||
addFormError(_("No password entered"));
|
||||
addFormError(_t("No password entered"));
|
||||
return;
|
||||
}
|
||||
ConsolePasswordManager mgr = new ConsolePasswordManager(_context);
|
||||
@@ -90,10 +90,10 @@ public class ConfigUIHandler extends FormHandler {
|
||||
if (mgr.saveMD5(RouterConsoleRunner.PROP_CONSOLE_PW, RouterConsoleRunner.JETTY_REALM, name, pw)) {
|
||||
if (!_context.getBooleanProperty(RouterConsoleRunner.PROP_PW_ENABLE))
|
||||
_context.router().saveConfig(RouterConsoleRunner.PROP_PW_ENABLE, "true");
|
||||
addFormNotice(_("Added user {0}", name));
|
||||
addFormError(_("Restart required to take effect"));
|
||||
addFormNotice(_t("Added user {0}", name));
|
||||
addFormError(_t("Restart required to take effect"));
|
||||
} else {
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs."));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,13 +108,13 @@ public class ConfigUIHandler extends FormHandler {
|
||||
continue;
|
||||
k = k.substring(7);
|
||||
if (mgr.remove(RouterConsoleRunner.PROP_CONSOLE_PW, k)) {
|
||||
addFormNotice(_("Removed user {0}", k));
|
||||
addFormNotice(_t("Removed user {0}", k));
|
||||
success = true;
|
||||
} else {
|
||||
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs."));
|
||||
addFormError(_t("Error saving the configuration (applied but not saved) - please see the error logs."));
|
||||
}
|
||||
}
|
||||
if (success)
|
||||
addFormError(_("Restart required to take effect"));
|
||||
addFormError(_t("Restart required to take effect"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@ public class ConfigUIHelper extends HelperBase {
|
||||
buf.append("<input type=\"radio\" class=\"optbox\" name=\"theme\" ");
|
||||
if (theme.equals(current))
|
||||
buf.append("checked=\"checked\" ");
|
||||
buf.append("value=\"").append(theme).append("\">").append(_(theme)).append("<br>\n");
|
||||
buf.append("value=\"").append(theme).append("\">").append(_t(theme)).append("<br>\n");
|
||||
}
|
||||
boolean universalTheming = _context.getBooleanProperty(CSSHelper.PROP_UNIVERSAL_THEMING);
|
||||
buf.append("<input type=\"checkbox\" name=\"universalTheming\" ");
|
||||
if (universalTheming)
|
||||
buf.append("checked=\"checked\" ");
|
||||
buf.append("value=\"1\">")
|
||||
.append(_("Set theme universally across all apps"))
|
||||
.append(_t("Set theme universally across all apps"))
|
||||
.append("<br>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class ConfigUIHelper extends HelperBase {
|
||||
if (forceMobileConsole)
|
||||
buf.append("checked=\"checked\" ");
|
||||
buf.append("value=\"1\">")
|
||||
.append(_("Force the mobile console to be used"))
|
||||
.append(_t("Force the mobile console to be used"))
|
||||
.append("<br>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
@@ -163,13 +163,13 @@ public class ConfigUIHelper extends HelperBase {
|
||||
buf.append("<table>");
|
||||
if (userpw.isEmpty()) {
|
||||
buf.append("<tr><td colspan=\"3\">");
|
||||
buf.append(_("Add a user and password to enable."));
|
||||
buf.append(_t("Add a user and password to enable."));
|
||||
buf.append("</td></tr>");
|
||||
} else {
|
||||
buf.append("<tr><th>")
|
||||
.append(_("Remove"))
|
||||
.append(_t("Remove"))
|
||||
.append("</th><th>")
|
||||
.append(_("User Name"))
|
||||
.append(_t("User Name"))
|
||||
.append("</th><th> </th></tr>\n");
|
||||
for (String name : userpw.keySet()) {
|
||||
buf.append("<tr><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"delete_")
|
||||
@@ -180,10 +180,10 @@ public class ConfigUIHelper extends HelperBase {
|
||||
}
|
||||
}
|
||||
buf.append("<tr><td align=\"center\"><b>")
|
||||
.append(_("Add")).append(":</b>" +
|
||||
.append(_t("Add")).append(":</b>" +
|
||||
"</td><td align=\"left\"><input type=\"text\" name=\"name\">" +
|
||||
"</td><td align=\"left\"><b>");
|
||||
buf.append(_("Password")).append(":</b> " +
|
||||
buf.append(_t("Password")).append(":</b> " +
|
||||
"<input type=\"password\" size=\"40\" name=\"nofilter_pw\"></td></tr>" +
|
||||
"</table>\n");
|
||||
return buf.toString();
|
||||
|
||||
@@ -157,14 +157,14 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
protected void processForm() {
|
||||
if (_action == null)
|
||||
return;
|
||||
if (_action.equals(_("Check for updates"))) {
|
||||
if (_action.equals(_t("Check for updates"))) {
|
||||
ConsoleUpdateManager mgr = UpdateHandler.updateManager(_context);
|
||||
if (mgr == null) {
|
||||
addFormError("Update manager not registered, cannot check");
|
||||
return;
|
||||
}
|
||||
if (mgr.isUpdateInProgress() || mgr.isCheckInProgress()) {
|
||||
addFormError(_("Update or check already in progress"));
|
||||
addFormError(_t("Update or check already in progress"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
if (shouldProxy && proxyPort == ConfigUpdateHandler.DEFAULT_PROXY_PORT_INT &&
|
||||
proxyHost.equals(ConfigUpdateHandler.DEFAULT_PROXY_HOST) &&
|
||||
_context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY) < 0) {
|
||||
addFormError(_("HTTP client proxy tunnel must be running"));
|
||||
addFormError(_t("HTTP client proxy tunnel must be running"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -187,19 +187,19 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
a3 = mgr.checkAvailable(ROUTER_UNSIGNED, 40*1000) != null;
|
||||
if (a1 || a2 || a3) {
|
||||
if ( (_updatePolicy == null) || (!_updatePolicy.equals("notify")) )
|
||||
addFormNotice(_("Update available, attempting to download now"));
|
||||
addFormNotice(_t("Update available, attempting to download now"));
|
||||
else
|
||||
addFormNotice(_("Update available, click button on left to download"));
|
||||
addFormNotice(_t("Update available, click button on left to download"));
|
||||
// So that update() will post a status to the summary bar before we reload
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException ie) {}
|
||||
} else
|
||||
addFormNotice(_("No update available"));
|
||||
addFormNotice(_t("No update available"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_action.equals(_("Save")))
|
||||
if (!_action.equals(_t("Save")))
|
||||
return;
|
||||
|
||||
Map<String, String> changes = new HashMap<String, String>();
|
||||
@@ -213,26 +213,26 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
changes.put(PROP_NEWS_URL, _newsURL);
|
||||
// this invalidates the news
|
||||
changes.put(NewsHelper.PROP_LAST_CHECKED, "0");
|
||||
addFormNotice(_("Updating news URL to {0}", _newsURL));
|
||||
addFormNotice(_t("Updating news URL to {0}", _newsURL));
|
||||
} else {
|
||||
addFormError("Changing news URL disabled");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_proxyHost != null && _proxyHost.length() > 0 && !_proxyHost.equals(_("internal"))) {
|
||||
if (_proxyHost != null && _proxyHost.length() > 0 && !_proxyHost.equals(_t("internal"))) {
|
||||
String oldHost = _context.router().getConfigSetting(PROP_PROXY_HOST);
|
||||
if ( (oldHost == null) || (!_proxyHost.equals(oldHost)) ) {
|
||||
changes.put(PROP_PROXY_HOST, _proxyHost);
|
||||
addFormNotice(_("Updating proxy host to {0}", _proxyHost));
|
||||
addFormNotice(_t("Updating proxy host to {0}", _proxyHost));
|
||||
}
|
||||
}
|
||||
|
||||
if (_proxyPort != null && _proxyPort.length() > 0 && !_proxyPort.equals(_("internal"))) {
|
||||
if (_proxyPort != null && _proxyPort.length() > 0 && !_proxyPort.equals(_t("internal"))) {
|
||||
String oldPort = _context.router().getConfigSetting(PROP_PROXY_PORT);
|
||||
if ( (oldPort == null) || (!_proxyPort.equals(oldPort)) ) {
|
||||
changes.put(PROP_PROXY_PORT, _proxyPort);
|
||||
addFormNotice(_("Updating proxy port to {0}", _proxyPort));
|
||||
addFormNotice(_t("Updating proxy port to {0}", _proxyPort));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,15 +248,15 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
try { oldFreq = Long.parseLong(oldFreqStr); } catch (NumberFormatException nfe) {}
|
||||
if (_refreshFrequency != oldFreq) {
|
||||
changes.put(PROP_REFRESH_FREQUENCY, ""+_refreshFrequency);
|
||||
addFormNoticeNoEscape(_("Updating refresh frequency to {0}",
|
||||
_refreshFrequency <= 0 ? _("Never") : DataHelper.formatDuration2(_refreshFrequency)));
|
||||
addFormNoticeNoEscape(_t("Updating refresh frequency to {0}",
|
||||
_refreshFrequency <= 0 ? _t("Never") : DataHelper.formatDuration2(_refreshFrequency)));
|
||||
}
|
||||
|
||||
if ( (_updatePolicy != null) && (_updatePolicy.length() > 0) ) {
|
||||
String oldPolicy = _context.router().getConfigSetting(PROP_UPDATE_POLICY);
|
||||
if ( (oldPolicy == null) || (!_updatePolicy.equals(oldPolicy)) ) {
|
||||
changes.put(PROP_UPDATE_POLICY, _updatePolicy);
|
||||
addFormNotice(_("Updating update policy to {0}", _updatePolicy));
|
||||
addFormNotice(_t("Updating update policy to {0}", _updatePolicy));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
String oldURL = _context.router().getConfigSetting(PROP_UPDATE_URL);
|
||||
if ( (oldURL == null) || (!_updateURL.equals(oldURL)) ) {
|
||||
changes.put(PROP_UPDATE_URL, _updateURL);
|
||||
addFormNotice(_("Updating update URLs."));
|
||||
addFormNotice(_t("Updating update URLs."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
// note that keys are not validated here and no console error message will be generated
|
||||
if (isAdvanced()) {
|
||||
changes.put(PROP_TRUSTED_KEYS, _trustedKeys);
|
||||
addFormNotice(_("Updating trusted keys."));
|
||||
addFormNotice(_t("Updating trusted keys."));
|
||||
} else {
|
||||
addFormError("Changing trusted keys disabled");
|
||||
}
|
||||
@@ -289,7 +289,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
if ( (oldURL == null) || (!_zipURL.equals(oldURL)) ) {
|
||||
if (isAdvanced()) {
|
||||
changes.put(PROP_ZIP_URL, _zipURL);
|
||||
addFormNotice(_("Updating unsigned update URL to {0}", _zipURL));
|
||||
addFormNotice(_t("Updating unsigned update URL to {0}", _zipURL));
|
||||
} else {
|
||||
addFormError("Changing unsigned update URL disabled");
|
||||
}
|
||||
@@ -301,7 +301,7 @@ public class ConfigUpdateHandler extends FormHandler {
|
||||
if ( (oldURL == null) || (!_devSU3URL.equals(oldURL)) ) {
|
||||
if (isAdvanced()) {
|
||||
changes.put(PROP_DEV_SU3_URL, _devSU3URL);
|
||||
addFormNotice(_("Updating signed development build URL to {0}", _devSU3URL));
|
||||
addFormNotice(_t("Updating signed development build URL to {0}", _devSU3URL));
|
||||
} else {
|
||||
addFormError("Changing signed update URL disabled");
|
||||
}
|
||||
|
||||
@@ -51,13 +51,13 @@ public class ConfigUpdateHelper extends HelperBase {
|
||||
|
||||
public String getProxyHost() {
|
||||
if (isInternal())
|
||||
return _("internal") + "\" readonly=\"readonly";
|
||||
return _t("internal") + "\" readonly=\"readonly";
|
||||
return _context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST);
|
||||
}
|
||||
|
||||
public String getProxyPort() {
|
||||
if (isInternal())
|
||||
return _("internal") + "\" readonly=\"readonly";
|
||||
return _t("internal") + "\" readonly=\"readonly";
|
||||
return Integer.toString(ConfigUpdateHandler.proxyPort(_context));
|
||||
}
|
||||
|
||||
@@ -127,9 +127,9 @@ public class ConfigUpdateHelper extends HelperBase {
|
||||
buf.append("\" selected=\"selected");
|
||||
|
||||
if (PERIODS[i] == -1)
|
||||
buf.append("\">").append(_("Never")).append("</option>\n");
|
||||
buf.append("\">").append(_t("Never")).append("</option>\n");
|
||||
else
|
||||
buf.append("\">").append(_("Every")).append(' ').append(DataHelper.formatDuration2(PERIODS[i])).append("</option>\n");
|
||||
buf.append("\">").append(_t("Every")).append(' ').append(DataHelper.formatDuration2(PERIODS[i])).append("</option>\n");
|
||||
}
|
||||
buf.append("</select>\n");
|
||||
return buf.toString();
|
||||
@@ -147,14 +147,14 @@ public class ConfigUpdateHelper extends HelperBase {
|
||||
buf.append("<option value=\"notify\"");
|
||||
if ("notify".equals(policy) || _dontInstall)
|
||||
buf.append(" selected=\"selected\"");
|
||||
buf.append('>').append(_("Notify only")).append("</option>");
|
||||
buf.append('>').append(_t("Notify only")).append("</option>");
|
||||
|
||||
buf.append("<option value=\"download\"");
|
||||
if (_dontInstall)
|
||||
buf.append(" disabled=\"disabled\"");
|
||||
else if ("download".equals(policy))
|
||||
buf.append(" selected=\"selected\"");
|
||||
buf.append('>').append(_("Download and verify only")).append("</option>");
|
||||
buf.append('>').append(_t("Download and verify only")).append("</option>");
|
||||
|
||||
if (_context.hasWrapper()) {
|
||||
buf.append("<option value=\"install\"");
|
||||
@@ -162,7 +162,7 @@ public class ConfigUpdateHelper extends HelperBase {
|
||||
buf.append(" disabled=\"disabled\"");
|
||||
else if ("install".equals(policy))
|
||||
buf.append(" selected=\"selected\"");
|
||||
buf.append('>').append(_("Download, verify, and restart")).append("</option>");
|
||||
buf.append('>').append(_t("Download, verify, and restart")).append("</option>");
|
||||
}
|
||||
|
||||
buf.append("</select>\n");
|
||||
|
||||
@@ -66,7 +66,7 @@ public class EventLogHelper extends FormHandler {
|
||||
public void setContextId(String contextId) {
|
||||
super.setContextId(contextId);
|
||||
for (int i = 0; i < _events.length; i += 2) {
|
||||
_xevents.put(_events[i], _(_events[i + 1]));
|
||||
_xevents.put(_events[i], _t(_events[i + 1]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,27 +99,27 @@ public class EventLogHelper extends FormHandler {
|
||||
// So just use the "shared/console nonce".
|
||||
String nonce = CSSHelper.getNonce();
|
||||
try {
|
||||
_out.write("<br><h3>" + _("Display Events") + "</h3>");
|
||||
_out.write("<br><h3>" + _t("Display Events") + "</h3>");
|
||||
_out.write("<form action=\"events\" method=\"POST\">\n" +
|
||||
"<input type=\"hidden\" name=\"action\" value=\"save\">\n" +
|
||||
"<input type=\"hidden\" name=\"nonce\" value=\"" + nonce + "\" >\n");
|
||||
_out.write(_("Events since") + ": <select name=\"from\">");
|
||||
_out.write(_t("Events since") + ": <select name=\"from\">");
|
||||
for (int i = 0; i < _times.length; i++) {
|
||||
writeOption(_times[i]);
|
||||
}
|
||||
_out.write("</select><br>");
|
||||
_out.write(_("Event type") + ": <select name=\"type\">");
|
||||
_out.write(_t("Event type") + ": <select name=\"type\">");
|
||||
// sorted by translated display string
|
||||
Map<String, String> events = new TreeMap<String, String>(Collator.getInstance());
|
||||
for (int i = 0; i < _events.length; i += 2) {
|
||||
events.put(_xevents.get(_events[i]), _events[i]);
|
||||
}
|
||||
writeOption(_("All events"), ALL);
|
||||
writeOption(_t("All events"), ALL);
|
||||
for (Map.Entry<String, String> e : events.entrySet()) {
|
||||
writeOption(e.getKey(), e.getValue());
|
||||
}
|
||||
_out.write("</select>" +
|
||||
"<hr><div class=\"formaction\"><input type=\"submit\" class=\"accept\" value=\"" + _("Filter events") + "\"></div></form>");
|
||||
"<hr><div class=\"formaction\"><input type=\"submit\" class=\"accept\" value=\"" + _t("Filter events") + "\"></div></form>");
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public class EventLogHelper extends FormHandler {
|
||||
_out.write(" selected=\"selected\"");
|
||||
_out.write(">");
|
||||
if (age == 0)
|
||||
_out.write(_("All events"));
|
||||
_out.write(_t("All events"));
|
||||
else
|
||||
_out.write(DataHelper.formatDuration2(age));
|
||||
_out.write("</option>\n");
|
||||
@@ -167,21 +167,21 @@ public class EventLogHelper extends FormHandler {
|
||||
if (events.isEmpty()) {
|
||||
if (isAll) {
|
||||
if (_age == 0)
|
||||
return _("No events found");
|
||||
return _("No events found in previous {0}", DataHelper.formatDuration2(_age));
|
||||
return _t("No events found");
|
||||
return _t("No events found in previous {0}", DataHelper.formatDuration2(_age));
|
||||
}
|
||||
if (_age == 0)
|
||||
return _("No \"{0}\" events found", xev);
|
||||
return _("No \"{0}\" events found in previous {1}", xev, DataHelper.formatDuration2(_age));
|
||||
return _t("No \"{0}\" events found", xev);
|
||||
return _t("No \"{0}\" events found in previous {1}", xev, DataHelper.formatDuration2(_age));
|
||||
}
|
||||
StringBuilder buf = new StringBuilder(2048);
|
||||
buf.append("<table><tr><th>");
|
||||
buf.append(_("Time"));
|
||||
buf.append(_t("Time"));
|
||||
buf.append("</th><th>");
|
||||
if (isAll) {
|
||||
buf.append(_("Event"));
|
||||
buf.append(_t("Event"));
|
||||
buf.append("</th><th>");
|
||||
buf.append(_("Details"));
|
||||
buf.append(_t("Details"));
|
||||
} else {
|
||||
buf.append(xev);
|
||||
}
|
||||
|
||||
@@ -248,9 +248,9 @@ public abstract class FormHandler {
|
||||
}
|
||||
|
||||
if (!_nonce.equals(_nonce1) && !_nonce.equals(_nonce2)) {
|
||||
addFormError(_("Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.")
|
||||
addFormError(_t("Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit.")
|
||||
+ ' ' +
|
||||
_("If the problem persists, verify that you have cookies enabled in your browser."));
|
||||
_t("If the problem persists, verify that you have cookies enabled in your browser."));
|
||||
_valid = false;
|
||||
}
|
||||
}
|
||||
@@ -291,28 +291,28 @@ public abstract class FormHandler {
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
public String _(String s) {
|
||||
public String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
/**
|
||||
* translate a string with a parameter
|
||||
* This is a lot more expensive than _(s), so use sparingly.
|
||||
* This is a lot more expensive than _t(s), so use sparingly.
|
||||
*
|
||||
* @param s string to be translated containing {0}
|
||||
* The {0} will be replaced by the parameter.
|
||||
* Single quotes must be doubled, i.e. ' -> '' in the string.
|
||||
* @param o parameter, not translated.
|
||||
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
|
||||
* To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
|
||||
* Do not double the single quotes in the parameter.
|
||||
* Use autoboxing to call with ints, longs, floats, etc.
|
||||
*/
|
||||
public String _(String s, Object o) {
|
||||
public String _t(String s, Object o) {
|
||||
return Messages.getString(s, o, _context);
|
||||
}
|
||||
|
||||
/** two params @since 0.8.2 */
|
||||
public String _(String s, Object o, Object o2) {
|
||||
public String _t(String s, Object o, Object o2) {
|
||||
return Messages.getString(s, o, o2, _context);
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,7 @@ public class GraphHelper extends FormHandler {
|
||||
+ "&w=" + (3 * _width)
|
||||
+ "&h=" + (3 * _height)
|
||||
+ "\">");
|
||||
String title = _("Combined bandwidth graph");
|
||||
String title = _t("Combined bandwidth graph");
|
||||
_out.write("<img class=\"statimage\""
|
||||
+ " src=\"viewstat.jsp?stat=bw.combined"
|
||||
+ "&periodCount=" + _periodCount
|
||||
@@ -171,7 +171,7 @@ public class GraphHelper extends FormHandler {
|
||||
for (SummaryListener lsnr : ordered) {
|
||||
Rate r = lsnr.getRate();
|
||||
// e.g. "statname for 60m"
|
||||
String title = _("{0} for {1}", r.getRateStat().getName(), DataHelper.formatDuration2(_periodCount * r.getPeriod()));
|
||||
String title = _t("{0} for {1}", r.getRateStat().getName(), DataHelper.formatDuration2(_periodCount * r.getPeriod()));
|
||||
_out.write("<a href=\"graph?stat="
|
||||
+ r.getRateStat().getName()
|
||||
+ '.' + r.getPeriod()
|
||||
@@ -194,7 +194,7 @@ public class GraphHelper extends FormHandler {
|
||||
|
||||
// FIXME jrobin doesn't support setting the timezone, will have to mod TimeAxis.java
|
||||
// 0.9.1 - all graphs currently state UTC on them, so this text blurb is unnecessary,
|
||||
//_out.write("<p><i>" + _("All times are UTC.") + "</i></p>\n");
|
||||
//_out.write("<p><i>" + _t("All times are UTC.") + "</i></p>\n");
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
@@ -220,7 +220,7 @@ public class GraphHelper extends FormHandler {
|
||||
if (_stat.equals("bw.combined")) {
|
||||
period = 60000;
|
||||
name = _stat;
|
||||
displayName = _("Bandwidth usage");
|
||||
displayName = _t("Bandwidth usage");
|
||||
} else {
|
||||
Set<Rate> rates = StatSummarizer.instance().parseSpecs(_stat);
|
||||
if (rates.size() != 1) {
|
||||
@@ -233,9 +233,9 @@ public class GraphHelper extends FormHandler {
|
||||
displayName = name;
|
||||
}
|
||||
_out.write("<h3>");
|
||||
_out.write(_("{0} for {1}", displayName, DataHelper.formatDuration2(_periodCount * period)));
|
||||
_out.write(_t("{0} for {1}", displayName, DataHelper.formatDuration2(_periodCount * period)));
|
||||
if (_end > 0)
|
||||
_out.write(' ' + _("ending {0} ago", DataHelper.formatDuration2(_end * period)));
|
||||
_out.write(' ' + _t("ending {0} ago", DataHelper.formatDuration2(_end * period)));
|
||||
|
||||
_out.write("</h3><img class=\"statimage\" border=\"0\""
|
||||
+ " src=\"viewstat.jsp?stat="
|
||||
@@ -250,57 +250,57 @@ public class GraphHelper extends FormHandler {
|
||||
|
||||
if (_width < MAX_X && _height < MAX_Y) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount, _end, _width * 3 / 2, _height * 3 / 2));
|
||||
_out.write(_("Larger"));
|
||||
_out.write(_t("Larger"));
|
||||
_out.write("</a> - ");
|
||||
}
|
||||
|
||||
if (_width > MIN_X && _height > MIN_Y) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount, _end, _width * 2 / 3, _height * 2 / 3));
|
||||
_out.write(_("Smaller"));
|
||||
_out.write(_t("Smaller"));
|
||||
_out.write("</a> - ");
|
||||
}
|
||||
|
||||
if (_height < MAX_Y) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount, _end, _width, _height * 3 / 2));
|
||||
_out.write(_("Taller"));
|
||||
_out.write(_t("Taller"));
|
||||
_out.write("</a> - ");
|
||||
}
|
||||
|
||||
if (_height > MIN_Y) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount, _end, _width, _height * 2 / 3));
|
||||
_out.write(_("Shorter"));
|
||||
_out.write(_t("Shorter"));
|
||||
_out.write("</a> - ");
|
||||
}
|
||||
|
||||
if (_width < MAX_X) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount, _end, _width * 3 / 2, _height));
|
||||
_out.write(_("Wider"));
|
||||
_out.write(_t("Wider"));
|
||||
_out.write("</a> - ");
|
||||
}
|
||||
|
||||
if (_width > MIN_X) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount, _end, _width * 2 / 3, _height));
|
||||
_out.write(_("Narrower"));
|
||||
_out.write(_t("Narrower"));
|
||||
_out.write("</a>");
|
||||
}
|
||||
|
||||
_out.write("<br>");
|
||||
if (_periodCount < MAX_C) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount * 2, _end, _width, _height));
|
||||
_out.write(_("Larger interval"));
|
||||
_out.write(_t("Larger interval"));
|
||||
_out.write("</a> - ");
|
||||
}
|
||||
|
||||
if (_periodCount > MIN_C) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount / 2, _end, _width, _height));
|
||||
_out.write(_("Smaller interval"));
|
||||
_out.write(_t("Smaller interval"));
|
||||
_out.write("</a>");
|
||||
}
|
||||
|
||||
_out.write("<br>");
|
||||
if (_periodCount < MAX_C) {
|
||||
_out.write(link(_stat, _showEvents, _periodCount, _end + _periodCount, _width, _height));
|
||||
_out.write(_("Previous interval"));
|
||||
_out.write(_t("Previous interval"));
|
||||
_out.write("</a>");
|
||||
}
|
||||
|
||||
@@ -311,17 +311,17 @@ public class GraphHelper extends FormHandler {
|
||||
if (_periodCount < MAX_C)
|
||||
_out.write(" - ");
|
||||
_out.write(link(_stat, _showEvents, _periodCount, end, _width, _height));
|
||||
_out.write(_("Next interval"));
|
||||
_out.write(_t("Next interval"));
|
||||
_out.write("</a> ");
|
||||
}
|
||||
|
||||
_out.write("<br>");
|
||||
_out.write(link(_stat, !_showEvents, _periodCount, _end, _width, _height));
|
||||
if (!_stat.equals("bw.combined"))
|
||||
_out.write(_showEvents ? _("Plot averages") : _("plot events"));
|
||||
_out.write(_showEvents ? _t("Plot averages") : _t("plot events"));
|
||||
_out.write("</a>");
|
||||
|
||||
_out.write("</p><p><i>" + _("All times are UTC.") + "</i></p>\n");
|
||||
_out.write("</p><p><i>" + _t("All times are UTC.") + "</i></p>\n");
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
@@ -353,17 +353,17 @@ public class GraphHelper extends FormHandler {
|
||||
// So just use the "shared/console nonce".
|
||||
String nonce = CSSHelper.getNonce();
|
||||
try {
|
||||
_out.write("<br><h3>" + _("Configure Graph Display") + " [<a href=\"configstats\">" + _("Select Stats") + "</a>]</h3>");
|
||||
_out.write("<br><h3>" + _t("Configure Graph Display") + " [<a href=\"configstats\">" + _t("Select Stats") + "</a>]</h3>");
|
||||
_out.write("<form action=\"graphs\" method=\"POST\">\n" +
|
||||
"<input type=\"hidden\" name=\"action\" value=\"save\">\n" +
|
||||
"<input type=\"hidden\" name=\"nonce\" value=\"" + nonce + "\" >\n");
|
||||
_out.write(_("Periods") + ": <input size=\"5\" style=\"text-align: right;\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\"><br>\n");
|
||||
_out.write(_("Plot averages") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"checked\" ") + "> ");
|
||||
_out.write(_("or")+ " " +_("plot events") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"checked\" " : "") + "><br>\n");
|
||||
_out.write(_("Image sizes") + ": " + _("width") + ": <input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"width\" value=\"" + _width
|
||||
+ "\"> " + _("pixels") + ", " + _("height") + ": <input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"height\" value=\"" + _height
|
||||
+ "\"> " + _("pixels") + "<br>\n");
|
||||
_out.write(_("Refresh delay") + ": <select name=\"refreshDelay\">");
|
||||
_out.write(_t("Periods") + ": <input size=\"5\" style=\"text-align: right;\" type=\"text\" name=\"periodCount\" value=\"" + _periodCount + "\"><br>\n");
|
||||
_out.write(_t("Plot averages") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"false\" " + (_showEvents ? "" : "checked=\"checked\" ") + "> ");
|
||||
_out.write(_t("or")+ " " +_t("plot events") + ": <input type=\"radio\" class=\"optbox\" name=\"showEvents\" value=\"true\" "+ (_showEvents ? "checked=\"checked\" " : "") + "><br>\n");
|
||||
_out.write(_t("Image sizes") + ": " + _t("width") + ": <input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"width\" value=\"" + _width
|
||||
+ "\"> " + _t("pixels") + ", " + _t("height") + ": <input size=\"4\" style=\"text-align: right;\" type=\"text\" name=\"height\" value=\"" + _height
|
||||
+ "\"> " + _t("pixels") + "<br>\n");
|
||||
_out.write(_t("Refresh delay") + ": <select name=\"refreshDelay\">");
|
||||
for (int i = 0; i < times.length; i++) {
|
||||
_out.write("<option value=\"");
|
||||
_out.write(Integer.toString(times[i]));
|
||||
@@ -374,17 +374,17 @@ public class GraphHelper extends FormHandler {
|
||||
if (times[i] > 0)
|
||||
_out.write(DataHelper.formatDuration2(times[i] * 1000));
|
||||
else
|
||||
_out.write(_("Never"));
|
||||
_out.write(_t("Never"));
|
||||
_out.write("</option>\n");
|
||||
}
|
||||
_out.write("</select><br>\n" +
|
||||
_("Store graph data on disk?") +
|
||||
_t("Store graph data on disk?") +
|
||||
" <input type=\"checkbox\" class=\"optbox\" value=\"true\" name=\"persistent\"");
|
||||
boolean persistent = _context.getBooleanPropertyDefaultTrue(SummaryListener.PROP_PERSISTENT);
|
||||
if (persistent)
|
||||
_out.write(" checked=\"checked\"");
|
||||
_out.write(">" +
|
||||
"<hr><div class=\"formaction\"><input type=\"submit\" class=\"accept\" value=\"" + _("Save settings and redraw graphs") + "\"></div></form>");
|
||||
"<hr><div class=\"formaction\"><input type=\"submit\" class=\"accept\" value=\"" + _t("Save settings and redraw graphs") + "\"></div></form>");
|
||||
} catch (IOException ioe) {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
@@ -440,7 +440,7 @@ public class GraphHelper extends FormHandler {
|
||||
changes.put(PROP_EVENTS, "" + _showEvents);
|
||||
changes.put(SummaryListener.PROP_PERSISTENT, "" + _persistent);
|
||||
_context.router().saveConfig(changes, null);
|
||||
addFormNotice(_("Graph settings saved"));
|
||||
addFormNotice(_t("Graph settings saved"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,28 +44,28 @@ public abstract class HelperBase {
|
||||
public void storeWriter(Writer out) { _out = out; }
|
||||
|
||||
/** translate a string */
|
||||
public String _(String s) {
|
||||
public String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
/**
|
||||
* translate a string with a parameter
|
||||
* This is a lot more expensive than _(s), so use sparingly.
|
||||
* This is a lot more expensive than _t(s), so use sparingly.
|
||||
*
|
||||
* @param s string to be translated containing {0}
|
||||
* The {0} will be replaced by the parameter.
|
||||
* Single quotes must be doubled, i.e. ' -> '' in the string.
|
||||
* @param o parameter, not translated.
|
||||
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
|
||||
* To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
|
||||
* Do not double the single quotes in the parameter.
|
||||
* Use autoboxing to call with ints, longs, floats, etc.
|
||||
*/
|
||||
public String _(String s, Object o) {
|
||||
public String _t(String s, Object o) {
|
||||
return Messages.getString(s, o, _context);
|
||||
}
|
||||
|
||||
/** two params @since 0.7.14 */
|
||||
public String _(String s, Object o, Object o2) {
|
||||
public String _t(String s, Object o, Object o2) {
|
||||
return Messages.getString(s, o, o2, _context);
|
||||
}
|
||||
|
||||
|
||||
@@ -105,9 +105,9 @@ public class HomeHelper extends HelperBase {
|
||||
public String getProxyStatus() {
|
||||
int port = _context.portMapper().getPort(PortMapper.SVC_HTTP_PROXY);
|
||||
if (port <= 0)
|
||||
return _("The HTTP proxy is not up");
|
||||
return _t("The HTTP proxy is not up");
|
||||
return "<img src=\"http://console.i2p/onepixel.png?" + _context.random().nextInt() + "\"" +
|
||||
" alt=\"" + _("Your browser is not properly configured to use the HTTP proxy at {0}",
|
||||
" alt=\"" + _t("Your browser is not properly configured to use the HTTP proxy at {0}",
|
||||
_context.getProperty(ConfigUpdateHandler.PROP_PROXY_HOST, ConfigUpdateHandler.DEFAULT_PROXY_HOST) + ':' + port) +
|
||||
"\">";
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public class HomeHelper extends HelperBase {
|
||||
}
|
||||
|
||||
private String renderApps(Collection<App> apps) {
|
||||
String website = _("Website");
|
||||
String website = _t("Website");
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<div class=\"appgroup\">");
|
||||
for (App app : apps) {
|
||||
@@ -205,11 +205,11 @@ public class HomeHelper extends HelperBase {
|
||||
private String renderConfig(Collection<App> apps) {
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<table><tr><th>")
|
||||
.append(_("Remove"))
|
||||
.append(_t("Remove"))
|
||||
.append("</th><th colspan=\"2\">")
|
||||
.append(_("Name"))
|
||||
.append(_t("Name"))
|
||||
.append("</th><th>")
|
||||
.append(_("URL"))
|
||||
.append(_t("URL"))
|
||||
.append("</th></tr>\n");
|
||||
for (App app : apps) {
|
||||
buf.append("<tr><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"delete_")
|
||||
@@ -232,7 +232,7 @@ public class HomeHelper extends HelperBase {
|
||||
buf.append("</a></td></tr>\n");
|
||||
}
|
||||
buf.append("<tr><td colspan=\"2\" align=\"center\"><b>")
|
||||
.append(_("Add")).append(":</b>" +
|
||||
.append(_t("Add")).append(":</b>" +
|
||||
"</td><td align=\"left\"><input type=\"text\" name=\"nofilter_name\"></td>" +
|
||||
"<td align=\"left\"><input type=\"text\" size=\"40\" name=\"nofilter_url\"></td></tr>");
|
||||
buf.append("</table>\n");
|
||||
|
||||
@@ -47,29 +47,29 @@ public class JobQueueHelper extends HelperBase {
|
||||
int numRunners = _context.jobQueue().getJobs(readyJobs, timedJobs, activeJobs, justFinishedJobs);
|
||||
|
||||
StringBuilder buf = new StringBuilder(32*1024);
|
||||
buf.append("<b><div class=\"joblog\"><h3>").append(_("I2P Job Queue")).append("</h3><br><div class=\"wideload\">")
|
||||
.append(_("Job runners")).append(": ").append(numRunners)
|
||||
buf.append("<b><div class=\"joblog\"><h3>").append(_t("I2P Job Queue")).append("</h3><br><div class=\"wideload\">")
|
||||
.append(_t("Job runners")).append(": ").append(numRunners)
|
||||
.append("</b><br>\n");
|
||||
|
||||
long now = _context.clock().now();
|
||||
|
||||
buf.append("<hr><b>").append(_("Active jobs")).append(": ").append(activeJobs.size()).append("</b><ol>\n");
|
||||
buf.append("<hr><b>").append(_t("Active jobs")).append(": ").append(activeJobs.size()).append("</b><ol>\n");
|
||||
for (int i = 0; i < activeJobs.size(); i++) {
|
||||
Job j = activeJobs.get(i);
|
||||
buf.append("<li>(").append(_("started {0} ago", DataHelper.formatDuration2(now-j.getTiming().getStartAfter()))).append("): ");
|
||||
buf.append("<li>(").append(_t("started {0} ago", DataHelper.formatDuration2(now-j.getTiming().getStartAfter()))).append("): ");
|
||||
buf.append(j.toString()).append("</li>\n");
|
||||
}
|
||||
buf.append("</ol>\n");
|
||||
|
||||
buf.append("<hr><b>").append(_("Just finished jobs")).append(": ").append(justFinishedJobs.size()).append("</b><ol>\n");
|
||||
buf.append("<hr><b>").append(_t("Just finished jobs")).append(": ").append(justFinishedJobs.size()).append("</b><ol>\n");
|
||||
for (int i = 0; i < justFinishedJobs.size(); i++) {
|
||||
Job j = justFinishedJobs.get(i);
|
||||
buf.append("<li>(").append(_("finished {0} ago", DataHelper.formatDuration2(now-j.getTiming().getActualEnd()))).append("): ");
|
||||
buf.append("<li>(").append(_t("finished {0} ago", DataHelper.formatDuration2(now-j.getTiming().getActualEnd()))).append("): ");
|
||||
buf.append(j.toString()).append("</li>\n");
|
||||
}
|
||||
buf.append("</ol>\n");
|
||||
|
||||
buf.append("<hr><b>").append(_("Ready/waiting jobs")).append(": ").append(readyJobs.size()).append("</b><ol>\n");
|
||||
buf.append("<hr><b>").append(_t("Ready/waiting jobs")).append(": ").append(readyJobs.size()).append("</b><ol>\n");
|
||||
ObjectCounter<String> counter = new ObjectCounter<String>();
|
||||
for (int i = 0; i < readyJobs.size(); i++) {
|
||||
Job j = readyJobs.get(i);
|
||||
@@ -86,7 +86,7 @@ public class JobQueueHelper extends HelperBase {
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
|
||||
buf.append("<hr><b>").append(_("Scheduled jobs")).append(": ").append(timedJobs.size()).append("</b><ol>\n");
|
||||
buf.append("<hr><b>").append(_t("Scheduled jobs")).append(": ").append(timedJobs.size()).append("</b><ol>\n");
|
||||
long prev = Long.MIN_VALUE;
|
||||
counter.clear();
|
||||
for (int i = 0; i < timedJobs.size(); i++) {
|
||||
@@ -96,7 +96,7 @@ public class JobQueueHelper extends HelperBase {
|
||||
continue;
|
||||
long time = j.getTiming().getStartAfter() - now;
|
||||
// translators: {0} is a job name, {1} is a time, e.g. 6 min
|
||||
buf.append("<li>").append(_("{0} will start in {1}", j.getName(), DataHelper.formatDuration2(time)));
|
||||
buf.append("<li>").append(_t("{0} will start in {1}", j.getName(), DataHelper.formatDuration2(time)));
|
||||
// debug, don't bother translating
|
||||
if (time < 0)
|
||||
buf.append(" <b>DELAYED</b>");
|
||||
@@ -110,7 +110,7 @@ public class JobQueueHelper extends HelperBase {
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
|
||||
buf.append("<hr><b>").append(_("Total Job Statistics")).append("</b>\n");
|
||||
buf.append("<hr><b>").append(_t("Total Job Statistics")).append("</b>\n");
|
||||
getJobStats(buf);
|
||||
out.write(buf.toString());
|
||||
}
|
||||
@@ -121,7 +121,7 @@ public class JobQueueHelper extends HelperBase {
|
||||
if (names.size() < 4)
|
||||
return;
|
||||
buf.append("<table style=\"width: 30%; margin-left: 100px;\">\n" +
|
||||
"<tr><th>").append(_("Job")).append("</th><th>").append(_("Queued")).append("<th>");
|
||||
"<tr><th>").append(_t("Job")).append("</th><th>").append(_t("Queued")).append("<th>");
|
||||
Collections.sort(names, new JobCountComparator(counter));
|
||||
for (String name : names) {
|
||||
buf.append("<tr><td>").append(name)
|
||||
@@ -138,12 +138,12 @@ public class JobQueueHelper extends HelperBase {
|
||||
*/
|
||||
private void getJobStats(StringBuilder buf) {
|
||||
buf.append("<table>\n" +
|
||||
"<tr><th>").append(_("Job")).append("</th><th>").append(_("Runs")).append("</th>" +
|
||||
"<th>").append(_("Dropped")).append("</th>" +
|
||||
"<th>").append(_("Time")).append("</th><th><i>").append(_("Avg")).append("</i></th><th><i>")
|
||||
.append(_("Max")).append("</i></th><th><i>").append(_("Min")).append("</i></th>" +
|
||||
"<th>").append(_("Pending")).append("</th><th><i>").append(_("Avg")).append("</i></th><th><i>")
|
||||
.append(_("Max")).append("</i></th><th><i>").append(_("Min")).append("</i></th></tr>\n");
|
||||
"<tr><th>").append(_t("Job")).append("</th><th>").append(_t("Runs")).append("</th>" +
|
||||
"<th>").append(_t("Dropped")).append("</th>" +
|
||||
"<th>").append(_t("Time")).append("</th><th><i>").append(_t("Avg")).append("</i></th><th><i>")
|
||||
.append(_t("Max")).append("</i></th><th><i>").append(_t("Min")).append("</i></th>" +
|
||||
"<th>").append(_t("Pending")).append("</th><th><i>").append(_t("Avg")).append("</i></th><th><i>")
|
||||
.append(_t("Max")).append("</i></th><th><i>").append(_t("Min")).append("</i></th></tr>\n");
|
||||
long totRuns = 0;
|
||||
long totDropped = 0;
|
||||
long totExecTime = 0;
|
||||
@@ -194,7 +194,7 @@ public class JobQueueHelper extends HelperBase {
|
||||
}
|
||||
|
||||
buf.append("<tr class=\"tablefooter\">");
|
||||
buf.append("<td><b>").append(_("Summary")).append("</b></td>");
|
||||
buf.append("<td><b>").append(_t("Summary")).append("</b></td>");
|
||||
buf.append("<td align=\"right\">").append(totRuns).append("</td>");
|
||||
buf.append("<td align=\"right\">").append(totDropped).append("</td>");
|
||||
buf.append("<td align=\"right\">").append(DataHelper.formatDuration2(totExecTime)).append("</td>");
|
||||
|
||||
@@ -46,7 +46,7 @@ public class LogsHelper extends HelperBase {
|
||||
*/
|
||||
public String getLogs() {
|
||||
String str = formatMessages(_context.logManager().getBuffer().getMostRecentMessages());
|
||||
return "<p>" + _("File location") + ": <b><code>" + _context.logManager().currentFile() + "</code></b></p>" + str;
|
||||
return "<p>" + _t("File location") + ": <b><code>" + _context.logManager().currentFile() + "</code></b></p>" + str;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,10 +97,10 @@ public class LogsHelper extends HelperBase {
|
||||
str = FileUtil.readTextFile(f.getAbsolutePath(), 250, false);
|
||||
}
|
||||
if (str == null) {
|
||||
return "<p>" + _("File not found") + ": <b><code>" + f.getAbsolutePath() + "</code></b></p>";
|
||||
return "<p>" + _t("File not found") + ": <b><code>" + f.getAbsolutePath() + "</code></b></p>";
|
||||
} else {
|
||||
str = str.replace("&", "&").replace("<", "<").replace(">", ">");
|
||||
return "<p>" + _("File location") + ": <b><code>" + f.getAbsolutePath() + "</code></b></p><pre>" + str + "</pre>";
|
||||
return "<p>" + _t("File location") + ": <b><code>" + f.getAbsolutePath() + "</code></b></p><pre>" + str + "</pre>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ public class LogsHelper extends HelperBase {
|
||||
/** formats in reverse order */
|
||||
private String formatMessages(List<String> msgs) {
|
||||
if (msgs.isEmpty())
|
||||
return "<p><i>" + _("No log messages") + "</i></p>";
|
||||
return "<p><i>" + _t("No log messages") + "</i></p>";
|
||||
boolean colorize = _context.getBooleanPropertyDefaultTrue("routerconsole.logs.color");
|
||||
StringBuilder buf = new StringBuilder(16*1024);
|
||||
buf.append("<ul>");
|
||||
@@ -138,13 +138,13 @@ public class LogsHelper extends HelperBase {
|
||||
// Homeland Security Advisory System
|
||||
// http://www.dhs.gov/xinfoshare/programs/Copy_of_press_release_0046.shtm
|
||||
// but pink instead of yellow for WARN
|
||||
if (msg.contains(_("CRIT")))
|
||||
if (msg.contains(_t("CRIT")))
|
||||
color = "#cc0000";
|
||||
else if (msg.contains(_("ERROR")))
|
||||
else if (msg.contains(_t("ERROR")))
|
||||
color = "#ff3300";
|
||||
else if (msg.contains(_("WARN")))
|
||||
else if (msg.contains(_t("WARN")))
|
||||
color = "#ff00cc";
|
||||
else if (msg.contains(_("INFO")))
|
||||
else if (msg.contains(_t("INFO")))
|
||||
color = "#000099";
|
||||
else
|
||||
color = "#006600";
|
||||
|
||||
@@ -24,7 +24,7 @@ public class Messages extends Translate {
|
||||
* The {0} will be replaced by the parameter.
|
||||
* Single quotes must be doubled, i.e. ' -> '' in the string.
|
||||
* @param o parameter, not translated.
|
||||
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
|
||||
* To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
|
||||
* Do not double the single quotes in the parameter.
|
||||
* Use autoboxing to call with ints, longs, floats, etc.
|
||||
*/
|
||||
|
||||
@@ -125,12 +125,12 @@ public class NetDbHelper extends HelperBase {
|
||||
// we are there
|
||||
if (span)
|
||||
buf.append("<span class=\"tab2\">");
|
||||
buf.append(_(titles[i]));
|
||||
buf.append(_t(titles[i]));
|
||||
} else {
|
||||
// we are not there, make a link
|
||||
if (span)
|
||||
buf.append("<span class=\"tab\">");
|
||||
buf.append("<a href=\"netdb").append(links[i]).append("\">").append(_(titles[i])).append("</a>");
|
||||
buf.append("<a href=\"netdb").append(links[i]).append("\">").append(_t(titles[i])).append("</a>");
|
||||
}
|
||||
if (span)
|
||||
buf.append(" </span>\n");
|
||||
|
||||
@@ -102,14 +102,14 @@ public class NetDbRenderer {
|
||||
}
|
||||
}
|
||||
if (notFound) {
|
||||
buf.append(_("Router")).append(' ');
|
||||
buf.append(_t("Router")).append(' ');
|
||||
if (routerPrefix != null)
|
||||
buf.append(routerPrefix);
|
||||
else if (version != null)
|
||||
buf.append(version);
|
||||
else if (country != null)
|
||||
buf.append(country);
|
||||
buf.append(' ').append(_("not found in network database"));
|
||||
buf.append(' ').append(_t("not found in network database"));
|
||||
}
|
||||
}
|
||||
out.write(buf.toString());
|
||||
@@ -153,12 +153,12 @@ public class NetDbRenderer {
|
||||
for (LeaseSet ls : leases) {
|
||||
Destination dest = ls.getDestination();
|
||||
Hash key = dest.calculateHash();
|
||||
buf.append("<b>").append(_("LeaseSet")).append(": ").append(key.toBase64()).append("</b>\n");
|
||||
buf.append("<b>").append(_t("LeaseSet")).append(": ").append(key.toBase64()).append("</b>\n");
|
||||
if (_context.clientManager().isLocal(dest)) {
|
||||
buf.append(" (<a href=\"tunnels#" + key.toBase64().substring(0,4) + "\">" + _("Local") + "</a> ");
|
||||
buf.append(" (<a href=\"tunnels#" + key.toBase64().substring(0,4) + "\">" + _t("Local") + "</a> ");
|
||||
if (! _context.clientManager().shouldPublishLeaseSet(key))
|
||||
buf.append(_("Unpublished") + ' ');
|
||||
buf.append(_("Destination") + ' ');
|
||||
buf.append(_t("Unpublished") + ' ');
|
||||
buf.append(_t("Destination") + ' ');
|
||||
TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(key);
|
||||
if (in != null && in.getDestinationNickname() != null)
|
||||
buf.append(in.getDestinationNickname());
|
||||
@@ -170,10 +170,10 @@ public class NetDbRenderer {
|
||||
String host = _context.namingService().reverseLookup(dest);
|
||||
if (host == null) {
|
||||
buf.append("<a href=\"/susidns/addressbook.jsp?book=private&destination=")
|
||||
.append(dest.toBase64()).append("#add\">").append(_("Add to local addressbook")).append("</a><br>\n");
|
||||
.append(dest.toBase64()).append("#add\">").append(_t("Add to local addressbook")).append("</a><br>\n");
|
||||
}
|
||||
} else {
|
||||
buf.append(" (").append(_("Destination")).append(' ');
|
||||
buf.append(" (").append(_t("Destination")).append(' ');
|
||||
String host = _context.namingService().reverseLookup(dest);
|
||||
if (host != null) {
|
||||
buf.append("<a href=\"http://").append(host).append("/\">").append(host).append("</a>)<br>\n");
|
||||
@@ -182,14 +182,14 @@ public class NetDbRenderer {
|
||||
buf.append(dest.toBase64().substring(0, 6)).append(")<br>\n" +
|
||||
"<a href=\"http://").append(b32).append("\">").append(b32).append("</a><br>\n" +
|
||||
"<a href=\"/susidns/addressbook.jsp?book=private&destination=")
|
||||
.append(dest.toBase64()).append("#add\">").append(_("Add to local addressbook")).append("</a><br>\n");
|
||||
.append(dest.toBase64()).append("#add\">").append(_t("Add to local addressbook")).append("</a><br>\n");
|
||||
}
|
||||
}
|
||||
long exp = ls.getLatestLeaseDate()-now;
|
||||
if (exp > 0)
|
||||
buf.append(_("Expires in {0}", DataHelper.formatDuration2(exp)));
|
||||
buf.append(_t("Expires in {0}", DataHelper.formatDuration2(exp)));
|
||||
else
|
||||
buf.append(_("Expired {0} ago", DataHelper.formatDuration2(0-exp)));
|
||||
buf.append(_t("Expired {0} ago", DataHelper.formatDuration2(0-exp)));
|
||||
buf.append("<br>\n");
|
||||
if (debug) {
|
||||
buf.append("RAP? " + ls.getReceivedAsPublished());
|
||||
@@ -208,15 +208,15 @@ public class NetDbRenderer {
|
||||
}
|
||||
for (int i = 0; i < ls.getLeaseCount(); i++) {
|
||||
Lease lease = ls.getLease(i);
|
||||
buf.append(_("Lease")).append(' ').append(i + 1).append(": ").append(_("Gateway")).append(' ');
|
||||
buf.append(_t("Lease")).append(' ').append(i + 1).append(": ").append(_t("Gateway")).append(' ');
|
||||
buf.append(_context.commSystem().renderPeerHTML(lease.getGateway()));
|
||||
buf.append(' ').append(_("Tunnel")).append(' ').append(lease.getTunnelId().getTunnelId()).append(' ');
|
||||
buf.append(' ').append(_t("Tunnel")).append(' ').append(lease.getTunnelId().getTunnelId()).append(' ');
|
||||
if (debug) {
|
||||
long exl = lease.getEndDate().getTime() - now;
|
||||
if (exl > 0)
|
||||
buf.append(_("Expires in {0}", DataHelper.formatDuration2(exl)));
|
||||
buf.append(_t("Expires in {0}", DataHelper.formatDuration2(exl)));
|
||||
else
|
||||
buf.append(_("Expired {0} ago", DataHelper.formatDuration2(0-exl)));
|
||||
buf.append(_t("Expired {0} ago", DataHelper.formatDuration2(0-exl)));
|
||||
}
|
||||
buf.append("<br>\n");
|
||||
}
|
||||
@@ -277,7 +277,7 @@ public class NetDbRenderer {
|
||||
*/
|
||||
public void renderStatusHTML(Writer out, int mode) throws IOException {
|
||||
if (!_context.netDb().isInitialized()) {
|
||||
out.write(_("Not initialized"));
|
||||
out.write(_t("Not initialized"));
|
||||
out.flush();
|
||||
return;
|
||||
}
|
||||
@@ -327,14 +327,14 @@ public class NetDbRenderer {
|
||||
|
||||
// the summary table
|
||||
buf.append("<table border=\"0\" cellspacing=\"30\"><tr><th colspan=\"3\">")
|
||||
.append(_("Network Database Router Statistics"))
|
||||
.append(_t("Network Database Router Statistics"))
|
||||
.append("</th></tr><tr><td style=\"vertical-align: top;\">");
|
||||
// versions table
|
||||
List<String> versionList = new ArrayList<String>(versions.objects());
|
||||
if (!versionList.isEmpty()) {
|
||||
Collections.sort(versionList, Collections.reverseOrder(new VersionComparator()));
|
||||
buf.append("<table>\n");
|
||||
buf.append("<tr><th>" + _("Version") + "</th><th>" + _("Count") + "</th></tr>\n");
|
||||
buf.append("<tr><th>" + _t("Version") + "</th><th>" + _t("Count") + "</th></tr>\n");
|
||||
for (String routerVersion : versionList) {
|
||||
int num = versions.count(routerVersion);
|
||||
String ver = DataHelper.stripHTML(routerVersion);
|
||||
@@ -349,11 +349,11 @@ public class NetDbRenderer {
|
||||
|
||||
// transports table
|
||||
buf.append("<table>\n");
|
||||
buf.append("<tr><th align=\"left\">" + _("Transports") + "</th><th>" + _("Count") + "</th></tr>\n");
|
||||
buf.append("<tr><th align=\"left\">" + _t("Transports") + "</th><th>" + _t("Count") + "</th></tr>\n");
|
||||
for (int i = 0; i < TNAMES.length; i++) {
|
||||
int num = transportCount[i];
|
||||
if (num > 0) {
|
||||
buf.append("<tr><td>").append(_(TNAMES[i]));
|
||||
buf.append("<tr><td>").append(_t(TNAMES[i]));
|
||||
buf.append("</td><td align=\"center\">").append(num).append("</td></tr>\n");
|
||||
}
|
||||
}
|
||||
@@ -367,7 +367,7 @@ public class NetDbRenderer {
|
||||
if (!countryList.isEmpty()) {
|
||||
Collections.sort(countryList, new CountryComparator());
|
||||
buf.append("<table>\n");
|
||||
buf.append("<tr><th align=\"left\">" + _("Country") + "</th><th>" + _("Count") + "</th></tr>\n");
|
||||
buf.append("<tr><th align=\"left\">" + _t("Country") + "</th><th>" + _t("Count") + "</th></tr>\n");
|
||||
for (String country : countryList) {
|
||||
int num = countries.count(country);
|
||||
buf.append("<tr><td><img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase(Locale.US)).append("\"");
|
||||
@@ -426,29 +426,29 @@ public class NetDbRenderer {
|
||||
String hash = info.getIdentity().getHash().toBase64();
|
||||
buf.append("<table><tr><th><a name=\"").append(hash.substring(0, 6)).append("\" ></a>");
|
||||
if (isUs) {
|
||||
buf.append("<a name=\"our-info\" ></a><b>" + _("Our info") + ": ").append(hash).append("</b></th></tr><tr><td>\n");
|
||||
buf.append("<a name=\"our-info\" ></a><b>" + _t("Our info") + ": ").append(hash).append("</b></th></tr><tr><td>\n");
|
||||
} else {
|
||||
buf.append("<b>" + _("Peer info for") + ":</b> ").append(hash).append("\n");
|
||||
buf.append("<b>" + _t("Peer info for") + ":</b> ").append(hash).append("\n");
|
||||
if (!full) {
|
||||
buf.append("[<a href=\"netdb?r=").append(hash.substring(0, 6)).append("\" >").append(_("Full entry")).append("</a>]");
|
||||
buf.append("[<a href=\"netdb?r=").append(hash.substring(0, 6)).append("\" >").append(_t("Full entry")).append("</a>]");
|
||||
}
|
||||
buf.append("</th></tr><tr><td>\n");
|
||||
}
|
||||
|
||||
long age = _context.clock().now() - info.getPublished();
|
||||
if (isUs && _context.router().isHidden()) {
|
||||
buf.append("<b>").append(_("Hidden")).append(", ").append(_("Updated")).append(":</b> ")
|
||||
.append(_("{0} ago", DataHelper.formatDuration2(age))).append("<br>\n");
|
||||
buf.append("<b>").append(_t("Hidden")).append(", ").append(_t("Updated")).append(":</b> ")
|
||||
.append(_t("{0} ago", DataHelper.formatDuration2(age))).append("<br>\n");
|
||||
} else if (age > 0) {
|
||||
buf.append("<b>").append(_("Published")).append(":</b> ")
|
||||
.append(_("{0} ago", DataHelper.formatDuration2(age))).append("<br>\n");
|
||||
buf.append("<b>").append(_t("Published")).append(":</b> ")
|
||||
.append(_t("{0} ago", DataHelper.formatDuration2(age))).append("<br>\n");
|
||||
} else {
|
||||
// shouldnt happen
|
||||
buf.append("<b>" + _("Published") + ":</b> in ").append(DataHelper.formatDuration2(0-age)).append("???<br>\n");
|
||||
buf.append("<b>" + _t("Published") + ":</b> in ").append(DataHelper.formatDuration2(0-age)).append("???<br>\n");
|
||||
}
|
||||
buf.append("<b>").append(_("Signing Key")).append(":</b> ")
|
||||
buf.append("<b>").append(_t("Signing Key")).append(":</b> ")
|
||||
.append(info.getIdentity().getSigningPublicKey().getType().toString());
|
||||
buf.append("<br>\n<b>" + _("Address(es)") + ":</b> ");
|
||||
buf.append("<br>\n<b>" + _t("Address(es)") + ":</b> ");
|
||||
String country = _context.commSystem().getCountry(info.getIdentity().getHash());
|
||||
if(country != null) {
|
||||
buf.append("<img height=\"11\" width=\"16\" alt=\"").append(country.toUpperCase(Locale.US)).append('\"');
|
||||
@@ -460,17 +460,17 @@ public class NetDbRenderer {
|
||||
buf.append("<b>").append(DataHelper.stripHTML(style)).append(":</b> ");
|
||||
int cost = addr.getCost();
|
||||
if (!((style.equals("SSU") && cost == 5) || (style.equals("NTCP") && cost == 10)))
|
||||
buf.append('[').append(_("cost")).append('=').append("" + cost).append("] ");
|
||||
buf.append('[').append(_t("cost")).append('=').append("" + cost).append("] ");
|
||||
Map<Object, Object> p = addr.getOptionsMap();
|
||||
for (Map.Entry<Object, Object> e : p.entrySet()) {
|
||||
String name = (String) e.getKey();
|
||||
String val = (String) e.getValue();
|
||||
buf.append('[').append(_(DataHelper.stripHTML(name))).append('=').append(DataHelper.stripHTML(val)).append("] ");
|
||||
buf.append('[').append(_t(DataHelper.stripHTML(name))).append('=').append(DataHelper.stripHTML(val)).append("] ");
|
||||
}
|
||||
}
|
||||
buf.append("</td></tr>\n");
|
||||
if (full) {
|
||||
buf.append("<tr><td>" + _("Stats") + ": <br><code>");
|
||||
buf.append("<tr><td>" + _t("Stats") + ": <br><code>");
|
||||
Map<Object, Object> p = info.getOptionsMap();
|
||||
for (Map.Entry<Object, Object> e : p.entrySet()) {
|
||||
String key = (String) e.getKey();
|
||||
@@ -514,7 +514,7 @@ public class NetDbRenderer {
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s) {
|
||||
private String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
@@ -525,17 +525,17 @@ public class NetDbRenderer {
|
||||
|
||||
/**
|
||||
* translate a string with a parameter
|
||||
* This is a lot more expensive than _(s), so use sparingly.
|
||||
* This is a lot more expensive than _t(s), so use sparingly.
|
||||
*
|
||||
* @param s string to be translated containing {0}
|
||||
* The {0} will be replaced by the parameter.
|
||||
* Single quotes must be doubled, i.e. ' -> '' in the string.
|
||||
* @param o parameter, not translated.
|
||||
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
|
||||
* To tranlslate parameter also, use _t("foo {0} bar", _t("baz"))
|
||||
* Do not double the single quotes in the parameter.
|
||||
* Use autoboxing to call with ints, longs, floats, etc.
|
||||
*/
|
||||
private String _(String s, Object o) {
|
||||
private String _t(String s, Object o) {
|
||||
return Messages.getString(s, o, _context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class ProfileOrganizerRenderer {
|
||||
////
|
||||
if (mode < 2) {
|
||||
|
||||
//buf.append("<h2>").append(_("Peer Profiles")).append("</h2>\n<p>");
|
||||
//buf.append("<h2>").append(_t("Peer Profiles")).append("</h2>\n<p>");
|
||||
buf.append(ngettext("Showing 1 recent profile.", "Showing {0} recent profiles.", order.size())).append('\n');
|
||||
if (older > 0)
|
||||
buf.append(ngettext("Hiding 1 older profile.", "Hiding {0} older profiles.", older)).append('\n');
|
||||
@@ -84,12 +84,12 @@ class ProfileOrganizerRenderer {
|
||||
buf.append("</p>");
|
||||
buf.append("<table>");
|
||||
buf.append("<tr>");
|
||||
buf.append("<th>").append(_("Peer")).append("</th>");
|
||||
buf.append("<th>").append(_("Groups (Caps)")).append("</th>");
|
||||
buf.append("<th>").append(_("Speed")).append("</th>");
|
||||
buf.append("<th>").append(_("Capacity")).append("</th>");
|
||||
buf.append("<th>").append(_("Integration")).append("</th>");
|
||||
buf.append("<th>").append(_("Status")).append("</th>");
|
||||
buf.append("<th>").append(_t("Peer")).append("</th>");
|
||||
buf.append("<th>").append(_t("Groups (Caps)")).append("</th>");
|
||||
buf.append("<th>").append(_t("Speed")).append("</th>");
|
||||
buf.append("<th>").append(_t("Capacity")).append("</th>");
|
||||
buf.append("<th>").append(_t("Integration")).append("</th>");
|
||||
buf.append("<th>").append(_t("Status")).append("</th>");
|
||||
buf.append("<th> </th>");
|
||||
buf.append("</tr>");
|
||||
int prevTier = 1;
|
||||
@@ -127,12 +127,12 @@ class ProfileOrganizerRenderer {
|
||||
buf.append("</td><td align=\"center\">");
|
||||
|
||||
switch (tier) {
|
||||
case 1: buf.append(_("Fast, High Capacity")); break;
|
||||
case 2: buf.append(_("High Capacity")); break;
|
||||
case 3: buf.append(_("Standard")); break;
|
||||
default: buf.append(_("Failing")); break;
|
||||
case 1: buf.append(_t("Fast, High Capacity")); break;
|
||||
case 2: buf.append(_t("High Capacity")); break;
|
||||
case 3: buf.append(_t("Standard")); break;
|
||||
default: buf.append(_t("Failing")); break;
|
||||
}
|
||||
if (isIntegrated) buf.append(", ").append(_("Integrated"));
|
||||
if (isIntegrated) buf.append(", ").append(_t("Integrated"));
|
||||
RouterInfo info = _context.netDb().lookupRouterInfoLocally(peer);
|
||||
if (info != null) {
|
||||
// prevent HTML injection in the caps and version
|
||||
@@ -163,9 +163,9 @@ class ProfileOrganizerRenderer {
|
||||
}
|
||||
buf.append("</td><td align=\"right\">").append(num(prof.getIntegrationValue()));
|
||||
buf.append("</td><td align=\"center\">");
|
||||
if (_context.banlist().isBanlisted(peer)) buf.append(_("Banned"));
|
||||
if (prof.getIsFailing()) buf.append(' ').append(_("Failing"));
|
||||
if (_context.commSystem().wasUnreachable(peer)) buf.append(' ').append(_("Unreachable"));
|
||||
if (_context.banlist().isBanlisted(peer)) buf.append(_t("Banned"));
|
||||
if (prof.getIsFailing()) buf.append(' ').append(_t("Failing"));
|
||||
if (_context.commSystem().wasUnreachable(peer)) buf.append(' ').append(_t("Unreachable"));
|
||||
RateAverages ra = RateAverages.getTemp();
|
||||
Rate failed = prof.getTunnelHistory().getFailedRate().getRate(30*60*1000);
|
||||
long fails = failed.computeAverages(ra, false).getTotalEventCount();
|
||||
@@ -173,13 +173,13 @@ class ProfileOrganizerRenderer {
|
||||
Rate accepted = prof.getTunnelCreateResponseTime().getRate(30*60*1000);
|
||||
long total = fails + accepted.computeAverages(ra, false).getTotalEventCount();
|
||||
if (total / fails <= 10) // hide if < 10%
|
||||
buf.append(' ').append(fails).append('/').append(total).append(' ').append(_("Test Fails"));
|
||||
buf.append(' ').append(fails).append('/').append(total).append(' ').append(_t("Test Fails"));
|
||||
}
|
||||
buf.append(" </td>");
|
||||
//buf.append("<td nowrap align=\"center\"><a target=\"_blank\" href=\"dumpprofile.jsp?peer=")
|
||||
// .append(peer.toBase64().substring(0,6)).append("\">").append(_("profile")).append("</a>");
|
||||
// .append(peer.toBase64().substring(0,6)).append("\">").append(_t("profile")).append("</a>");
|
||||
buf.append("<td nowrap align=\"center\"><a href=\"viewprofile?peer=")
|
||||
.append(peer.toBase64()).append("\">").append(_("profile")).append("</a>");
|
||||
.append(peer.toBase64()).append("\">").append(_t("profile")).append("</a>");
|
||||
buf.append(" <a href=\"configpeer?peer=").append(peer.toBase64()).append("\">+-</a></td>\n");
|
||||
buf.append("</tr>");
|
||||
// let's not build the whole page in memory (~500 bytes per peer)
|
||||
@@ -193,26 +193,26 @@ class ProfileOrganizerRenderer {
|
||||
////
|
||||
} else {
|
||||
|
||||
//buf.append("<h2><a name=\"flood\"></a>").append(_("Floodfill and Integrated Peers"))
|
||||
//buf.append("<h2><a name=\"flood\"></a>").append(_t("Floodfill and Integrated Peers"))
|
||||
// .append(" (").append(integratedPeers.size()).append(")</h2>\n");
|
||||
buf.append("<table>");
|
||||
buf.append("<tr>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Peer")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Caps")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Integ. Value")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Last Heard About")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Last Heard From")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Last Good Send")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Last Bad Send")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("10m Resp. Time")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("1h Resp. Time")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("1d Resp. Time")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Last Good Lookup")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Last Bad Lookup")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Last Good Store")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("Last Bad Store")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("1h Fail Rate")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_("1d Fail Rate")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Peer")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Caps")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Integ. Value")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Last Heard About")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Last Heard From")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Last Good Send")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Last Bad Send")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("10m Resp. Time")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("1h Resp. Time")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("1d Resp. Time")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Last Good Lookup")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Last Bad Lookup")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Last Good Store")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("Last Bad Store")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("1h Fail Rate")).append("</th>");
|
||||
buf.append("<th class=\"smallhead\">").append(_t("1d Fail Rate")).append("</th>");
|
||||
buf.append("</tr>");
|
||||
RateAverages ra = RateAverages.getTemp();
|
||||
for (PeerProfile prof : order) {
|
||||
@@ -244,7 +244,7 @@ class ProfileOrganizerRenderer {
|
||||
buf.append("<td align=\"right\">").append(davg(dbh, 24*60*60*1000l, ra)).append("</td>");
|
||||
} else {
|
||||
for (int i = 0; i < 6; i++)
|
||||
buf.append("<td align=\"right\">").append(_(NA));
|
||||
buf.append("<td align=\"right\">").append(_t(NA));
|
||||
}
|
||||
buf.append("</tr>\n");
|
||||
}
|
||||
@@ -256,20 +256,20 @@ class ProfileOrganizerRenderer {
|
||||
}
|
||||
if (mode < 2) {
|
||||
|
||||
buf.append("<h3>").append(_("Thresholds")).append("</h3>");
|
||||
buf.append("<p><b>").append(_("Speed")).append(":</b> ").append(num(_organizer.getSpeedThreshold()))
|
||||
.append(" (").append(fast).append(' ').append(_("fast peers")).append(")<br>");
|
||||
buf.append("<b>").append(_("Capacity")).append(":</b> ").append(num(_organizer.getCapacityThreshold()))
|
||||
.append(" (").append(reliable).append(' ').append(_("high capacity peers")).append(")<br>");
|
||||
buf.append("<b>").append(_("Integration")).append(":</b> ").append(num(_organizer.getIntegrationThreshold()))
|
||||
.append(" (").append(integrated).append(' ').append(_(" well integrated peers")).append(")</p>");
|
||||
buf.append("<h3>").append(_("Definitions")).append("</h3><ul>");
|
||||
buf.append("<li><b>").append(_("groups")).append("</b>: ").append(_("as determined by the profile organizer")).append("</li>");
|
||||
buf.append("<li><b>").append(_("caps")).append("</b>: ").append(_("capabilities in the netDb, not used to determine profiles")).append("</li>");
|
||||
buf.append("<li><b>").append(_("speed")).append("</b>: ").append(_("peak throughput (bytes per second) over a 1 minute period that the peer has sustained in a single tunnel")).append("</li>");
|
||||
buf.append("<li><b>").append(_("capacity")).append("</b>: ").append(_("how many tunnels can we ask them to join in an hour?")).append("</li>");
|
||||
buf.append("<li><b>").append(_("integration")).append("</b>: ").append(_("how many new peers have they told us about lately?")).append("</li>");
|
||||
buf.append("<li><b>").append(_("status")).append("</b>: ").append(_("is the peer banned, or unreachable, or failing tunnel tests?")).append("</li>");
|
||||
buf.append("<h3>").append(_t("Thresholds")).append("</h3>");
|
||||
buf.append("<p><b>").append(_t("Speed")).append(":</b> ").append(num(_organizer.getSpeedThreshold()))
|
||||
.append(" (").append(fast).append(' ').append(_t("fast peers")).append(")<br>");
|
||||
buf.append("<b>").append(_t("Capacity")).append(":</b> ").append(num(_organizer.getCapacityThreshold()))
|
||||
.append(" (").append(reliable).append(' ').append(_t("high capacity peers")).append(")<br>");
|
||||
buf.append("<b>").append(_t("Integration")).append(":</b> ").append(num(_organizer.getIntegrationThreshold()))
|
||||
.append(" (").append(integrated).append(' ').append(_t(" well integrated peers")).append(")</p>");
|
||||
buf.append("<h3>").append(_t("Definitions")).append("</h3><ul>");
|
||||
buf.append("<li><b>").append(_t("groups")).append("</b>: ").append(_t("as determined by the profile organizer")).append("</li>");
|
||||
buf.append("<li><b>").append(_t("caps")).append("</b>: ").append(_t("capabilities in the netDb, not used to determine profiles")).append("</li>");
|
||||
buf.append("<li><b>").append(_t("speed")).append("</b>: ").append(_t("peak throughput (bytes per second) over a 1 minute period that the peer has sustained in a single tunnel")).append("</li>");
|
||||
buf.append("<li><b>").append(_t("capacity")).append("</b>: ").append(_t("how many tunnels can we ask them to join in an hour?")).append("</li>");
|
||||
buf.append("<li><b>").append(_t("integration")).append("</b>: ").append(_t("how many new peers have they told us about lately?")).append("</li>");
|
||||
buf.append("<li><b>").append(_t("status")).append("</b>: ").append(_t("is the peer banned, or unreachable, or failing tunnel tests?")).append("</li>");
|
||||
buf.append("</ul>");
|
||||
|
||||
////
|
||||
@@ -336,13 +336,13 @@ class ProfileOrganizerRenderer {
|
||||
private String avg (PeerProfile prof, long rate, RateAverages ra) {
|
||||
RateStat rs = prof.getDbResponseTime();
|
||||
if (rs == null)
|
||||
return _(NA);
|
||||
return _t(NA);
|
||||
Rate r = rs.getRate(rate);
|
||||
if (r == null)
|
||||
return _(NA);
|
||||
return _t(NA);
|
||||
r.computeAverages(ra, false);
|
||||
if (ra.getTotalEventCount() == 0)
|
||||
return _(NA);
|
||||
return _t(NA);
|
||||
return DataHelper.formatDuration2(Math.round(ra.getAverage()));
|
||||
}
|
||||
|
||||
@@ -363,12 +363,12 @@ class ProfileOrganizerRenderer {
|
||||
/** @since 0.9.21 */
|
||||
private String formatInterval(long now, long then) {
|
||||
if (then <= 0)
|
||||
return _(NA);
|
||||
return _t(NA);
|
||||
return DataHelper.formatDuration2(now - then);
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s) {
|
||||
private String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,12 +104,12 @@ public class ProfilesHelper extends HelperBase {
|
||||
// we are there
|
||||
if (span)
|
||||
buf.append("<span class=\"tab2\">");
|
||||
buf.append(_(titles[i]));
|
||||
buf.append(_t(titles[i]));
|
||||
} else {
|
||||
// we are not there, make a link
|
||||
if (span)
|
||||
buf.append("<span class=\"tab\">");
|
||||
buf.append("<a href=\"profiles").append(links[i]).append("\">").append(_(titles[i])).append("</a>");
|
||||
buf.append("<a href=\"profiles").append(links[i]).append("\">").append(_t(titles[i])).append("</a>");
|
||||
}
|
||||
if (span)
|
||||
buf.append(" </span>\n");
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SearchHelper extends HelperBase {
|
||||
}
|
||||
}
|
||||
StringBuilder buf = new StringBuilder(1024);
|
||||
buf.append("<select name=\"engine\" title=\"").append(_("Select search engine")).append("\">");
|
||||
buf.append("<select name=\"engine\" title=\"").append(_t("Select search engine")).append("\">");
|
||||
for (String name : _engines.keySet()) {
|
||||
buf.append("<option value=\"").append(name).append('\"');
|
||||
if (name.equals(dflt))
|
||||
|
||||
@@ -329,7 +329,7 @@ public class StatSummarizer implements Runnable {
|
||||
else if (height <= 0)
|
||||
height = GraphHelper.DEFAULT_Y;
|
||||
txLsnr.renderPng(out, width, height, hideLegend, hideGrid, hideTitle, showEvents, periodCount,
|
||||
end, showCredit, rxLsnr, _("Bandwidth usage"));
|
||||
end, showCredit, rxLsnr, _t("Bandwidth usage"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -375,7 +375,7 @@ public class StatSummarizer implements Runnable {
|
||||
private static final boolean IS_WIN = SystemVersion.isWindows();
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s) {
|
||||
private String _t(String s) {
|
||||
// the RRD font doesn't have zh chars, at least on my system
|
||||
// Works on 1.5.9 except on windows
|
||||
if (IS_WIN && "zh".equals(Messages.getLanguage(_context)))
|
||||
|
||||
@@ -40,7 +40,7 @@ public class StatsGenerator {
|
||||
groups.putAll(unsorted);
|
||||
for (String group : groups.keySet()) {
|
||||
buf.append("<option value=\"#").append(group).append("\">");
|
||||
buf.append(_(group)).append("</option>\n");
|
||||
buf.append(_t(group)).append("</option>\n");
|
||||
// let's just do the groups
|
||||
//Set stats = (Set)entry.getValue();
|
||||
//for (Iterator statIter = stats.iterator(); statIter.hasNext(); ) {
|
||||
@@ -54,14 +54,14 @@ public class StatsGenerator {
|
||||
//out.write(buf.toString());
|
||||
//buf.setLength(0);
|
||||
}
|
||||
buf.append("</select> <input type=\"submit\" value=\"").append(_("GO")).append("\" />");
|
||||
buf.append("</select> <input type=\"submit\" value=\"").append(_t("GO")).append("\" />");
|
||||
buf.append("</form>");
|
||||
|
||||
buf.append(_("Statistics gathered during this router's uptime")).append(" (");
|
||||
buf.append(_t("Statistics gathered during this router's uptime")).append(" (");
|
||||
long uptime = _context.router().getUptime();
|
||||
buf.append(DataHelper.formatDuration2(uptime));
|
||||
buf.append("). ").append( _("The data gathered is quantized over a 1 minute period, so should just be used as an estimate."));
|
||||
buf.append(' ').append( _("These statistics are primarily used for development and debugging."));
|
||||
buf.append("). ").append( _t("The data gathered is quantized over a 1 minute period, so should just be used as an estimate."));
|
||||
buf.append(' ').append( _t("These statistics are primarily used for development and debugging."));
|
||||
|
||||
out.write(buf.toString());
|
||||
buf.setLength(0);
|
||||
@@ -72,7 +72,7 @@ public class StatsGenerator {
|
||||
buf.append("<h3><a name=\"");
|
||||
buf.append(group);
|
||||
buf.append("\">");
|
||||
buf.append(_(group));
|
||||
buf.append(_t(group));
|
||||
buf.append("</a></h3>");
|
||||
buf.append("<ul>");
|
||||
out.write(buf.toString());
|
||||
@@ -102,7 +102,7 @@ public class StatsGenerator {
|
||||
buf.append(freq.getDescription());
|
||||
buf.append("</i><br>");
|
||||
if (freq.getEventCount() <= 0) {
|
||||
buf.append(_("No lifetime events")).append("<br>\n");
|
||||
buf.append(_t("No lifetime events")).append("<br>\n");
|
||||
return;
|
||||
}
|
||||
long uptime = _context.router().getUptime();
|
||||
@@ -113,15 +113,15 @@ public class StatsGenerator {
|
||||
if (periods[i] > uptime)
|
||||
break;
|
||||
buf.append("<li>");
|
||||
renderPeriod(buf, periods[i], _("frequency"));
|
||||
renderPeriod(buf, periods[i], _t("frequency"));
|
||||
Frequency curFreq = freq.getFrequency(periods[i]);
|
||||
buf.append(DataHelper.formatDuration2(Math.round(curFreq.getAverageInterval())));
|
||||
buf.append("; ");
|
||||
buf.append(_("Rolling average events per period"));
|
||||
buf.append(_t("Rolling average events per period"));
|
||||
buf.append(": ");
|
||||
buf.append(num(curFreq.getAverageEventsPerPeriod()));
|
||||
buf.append("; ");
|
||||
buf.append(_("Highest events per period"));
|
||||
buf.append(_t("Highest events per period"));
|
||||
buf.append(": ");
|
||||
buf.append(num(curFreq.getMaxAverageEventsPerPeriod()));
|
||||
buf.append("; ");
|
||||
@@ -132,12 +132,12 @@ public class StatsGenerator {
|
||||
//}
|
||||
//buf.append(" <i>avg interval between updates:</i> (").append(num(curFreq.getAverageInterval())).append("ms, min ");
|
||||
//buf.append(num(curFreq.getMinAverageInterval())).append("ms)");
|
||||
buf.append(_("Lifetime average events per period")).append(": ");
|
||||
buf.append(_t("Lifetime average events per period")).append(": ");
|
||||
buf.append(num(curFreq.getStrictAverageEventsPerPeriod()));
|
||||
buf.append("</li>\n");
|
||||
}
|
||||
// Display the strict average
|
||||
buf.append("<li><b>").append(_("Lifetime average frequency")).append(":</b> ");
|
||||
buf.append("<li><b>").append(_t("Lifetime average frequency")).append(":</b> ");
|
||||
buf.append(DataHelper.formatDuration2(freq.getFrequency()));
|
||||
buf.append(" (");
|
||||
buf.append(ngettext("1 event", "{0} events", (int) freq.getEventCount()));
|
||||
@@ -153,7 +153,7 @@ public class StatsGenerator {
|
||||
buf.append("</i><br>");
|
||||
}
|
||||
if (rate.getLifetimeEventCount() <= 0) {
|
||||
buf.append(_("No lifetime events")).append("<br>\n");
|
||||
buf.append(_t("No lifetime events")).append("<br>\n");
|
||||
return;
|
||||
}
|
||||
long now = _context.clock().now();
|
||||
@@ -165,12 +165,12 @@ public class StatsGenerator {
|
||||
if (curRate.getLastCoalesceDate() <= curRate.getCreationDate())
|
||||
break;
|
||||
buf.append("<li>");
|
||||
renderPeriod(buf, periods[i], _("rate"));
|
||||
renderPeriod(buf, periods[i], _t("rate"));
|
||||
if (curRate.getLastEventCount() > 0) {
|
||||
buf.append(_("Average")).append(": ");
|
||||
buf.append(_t("Average")).append(": ");
|
||||
buf.append(num(curRate.getAverageValue()));
|
||||
buf.append("; ");
|
||||
buf.append(_("Highest average"));
|
||||
buf.append(_t("Highest average"));
|
||||
buf.append(": ");
|
||||
buf.append(num(curRate.getExtremeAverageValue()));
|
||||
buf.append("; ");
|
||||
@@ -199,16 +199,16 @@ public class StatsGenerator {
|
||||
|
||||
buf.append(ngettext("There was 1 event in this period.", "There were {0} events in this period.", (int)curRate.getLastEventCount()));
|
||||
buf.append(' ');
|
||||
buf.append(_("The period ended {0} ago.", DataHelper.formatDuration2(now - curRate.getLastCoalesceDate())));
|
||||
buf.append(_t("The period ended {0} ago.", DataHelper.formatDuration2(now - curRate.getLastCoalesceDate())));
|
||||
} else {
|
||||
buf.append(" <i>").append(_("No events")).append("</i> ");
|
||||
buf.append(" <i>").append(_t("No events")).append("</i> ");
|
||||
}
|
||||
long numPeriods = curRate.getLifetimePeriods();
|
||||
if (numPeriods > 0) {
|
||||
double avgFrequency = curRate.getLifetimeEventCount() / (double)numPeriods;
|
||||
buf.append(" (").append(_("Average event count")).append(": ");
|
||||
buf.append(" (").append(_t("Average event count")).append(": ");
|
||||
buf.append(num(avgFrequency));
|
||||
buf.append("; ").append(_("Events in peak period")).append(": ");
|
||||
buf.append("; ").append(_t("Events in peak period")).append(": ");
|
||||
// This isn't really the highest event count, but the event count during the period with the highest total value.
|
||||
buf.append(curRate.getExtremeEventCount());
|
||||
buf.append(")");
|
||||
@@ -216,19 +216,19 @@ public class StatsGenerator {
|
||||
if (curRate.getSummaryListener() != null) {
|
||||
buf.append(" <a href=\"graph?stat=").append(name)
|
||||
.append('.').append(periods[i]);
|
||||
buf.append("\">").append(_("Graph Data")).append("</a> - ");
|
||||
buf.append("\">").append(_t("Graph Data")).append("</a> - ");
|
||||
buf.append(" <a href=\"graph?stat=").append(name)
|
||||
.append('.').append(periods[i]);
|
||||
buf.append("&showEvents=true\">").append(_("Graph Event Count")).append("</a>");
|
||||
buf.append("&showEvents=true\">").append(_t("Graph Event Count")).append("</a>");
|
||||
// This can really blow up your browser if you click on it
|
||||
//buf.append(" - <a href=\"viewstat.jsp?stat=").append(name);
|
||||
//buf.append("&period=").append(periods[i]);
|
||||
//buf.append("&format=xml\">").append(_("Export Data as XML")).append("</a>");
|
||||
//buf.append("&format=xml\">").append(_t("Export Data as XML")).append("</a>");
|
||||
}
|
||||
buf.append("</li>\n");
|
||||
}
|
||||
// Display the strict average
|
||||
buf.append("<li><b>").append(_("Lifetime average value")).append(":</b> ");
|
||||
buf.append("<li><b>").append(_t("Lifetime average value")).append(":</b> ");
|
||||
buf.append(num(rate.getLifetimeAverageValue()));
|
||||
buf.append(" (");
|
||||
buf.append(ngettext("1 event", "{0} events", (int) rate.getLifetimeEventCount()));
|
||||
@@ -258,19 +258,19 @@ public class StatsGenerator {
|
||||
*/
|
||||
private class AlphaComparator implements Comparator<String> {
|
||||
public int compare(String lhs, String rhs) {
|
||||
String lname = _(lhs);
|
||||
String rname = _(rhs);
|
||||
String lname = _t(lhs);
|
||||
String rname = _t(rhs);
|
||||
return Collator.getInstance().compare(lname, rname);
|
||||
}
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s) {
|
||||
private String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s, Object o) {
|
||||
private String _t(String s, Object o) {
|
||||
return Messages.getString(s, o, _context);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,9 +124,9 @@ public class SummaryBarRenderer {
|
||||
public String renderHelpAndFAQHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
.append(_("I2P Router Help & FAQ"))
|
||||
.append(_t("I2P Router Help & FAQ"))
|
||||
.append("\">")
|
||||
.append(_("Help & FAQ"))
|
||||
.append(_t("Help & FAQ"))
|
||||
.append("</a></h3>");
|
||||
return buf.toString();
|
||||
}
|
||||
@@ -134,23 +134,23 @@ public class SummaryBarRenderer {
|
||||
public String renderI2PServicesHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/configclients\" target=\"_top\" title=\"")
|
||||
.append(_("Configure startup of clients and webapps (services); manually start dormant services"))
|
||||
.append(_t("Configure startup of clients and webapps (services); manually start dormant services"))
|
||||
.append("\">")
|
||||
.append(_("I2P Services"))
|
||||
.append(_t("I2P Services"))
|
||||
.append("</a></h3>\n" +
|
||||
|
||||
"<hr class=\"b\"><table><tr><td>" +
|
||||
|
||||
"<a href=\"/susimail/susimail\" target=\"_blank\" title=\"")
|
||||
.append(_("Anonymous webmail client"))
|
||||
.append(_t("Anonymous webmail client"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Email")))
|
||||
.append(nbsp(_t("Email")))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/i2psnark/\" target=\"_blank\" title=\"")
|
||||
.append(_("Built-in anonymous BitTorrent Client"))
|
||||
.append(_t("Built-in anonymous BitTorrent Client"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Torrents")))
|
||||
.append(nbsp(_t("Torrents")))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"http://")
|
||||
@@ -158,9 +158,9 @@ public class SummaryBarRenderer {
|
||||
.append(':')
|
||||
.append(_context.portMapper().getPort(PortMapper.SVC_EEPSITE, 7658))
|
||||
.append("/\" target=\"_blank\" title=\"")
|
||||
.append(_("Local web server"))
|
||||
.append(_t("Local web server"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Website")))
|
||||
.append(nbsp(_t("Website")))
|
||||
.append("</a>\n")
|
||||
|
||||
.append(NavHelper.getClientAppLinks(_context))
|
||||
@@ -172,73 +172,73 @@ public class SummaryBarRenderer {
|
||||
public String renderI2PInternalsHTML() {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/config\" target=\"_top\" title=\"")
|
||||
.append(_("Configure I2P Router"))
|
||||
.append(_t("Configure I2P Router"))
|
||||
.append("\">")
|
||||
.append(_("I2P Internals"))
|
||||
.append(_t("I2P Internals"))
|
||||
.append("</a></h3><hr class=\"b\">\n" +
|
||||
|
||||
"<table><tr><td>\n" +
|
||||
|
||||
"<a href=\"/tunnels\" target=\"_top\" title=\"")
|
||||
.append(_("View existing tunnels and tunnel build status"))
|
||||
.append(_t("View existing tunnels and tunnel build status"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Tunnels")))
|
||||
.append(nbsp(_t("Tunnels")))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/peers\" target=\"_top\" title=\"")
|
||||
.append(_("Show all current peer connections"))
|
||||
.append(_t("Show all current peer connections"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Peers")))
|
||||
.append(nbsp(_t("Peers")))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/profiles\" target=\"_top\" title=\"")
|
||||
.append(_("Show recent peer performance profiles"))
|
||||
.append(_t("Show recent peer performance profiles"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Profiles")))
|
||||
.append(nbsp(_t("Profiles")))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/netdb\" target=\"_top\" title=\"")
|
||||
.append(_("Show list of all known I2P routers"))
|
||||
.append(_t("Show list of all known I2P routers"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("NetDB")))
|
||||
.append(nbsp(_t("NetDB")))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/logs\" target=\"_top\" title=\"")
|
||||
.append(_("Health Report"))
|
||||
.append(_t("Health Report"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Logs")))
|
||||
.append(nbsp(_t("Logs")))
|
||||
.append("</a>\n");
|
||||
|
||||
// "<a href=\"/jobs.jsp\" target=\"_top\" title=\"")
|
||||
// .append(_("Show the router's workload, and how it's performing"))
|
||||
// .append(_t("Show the router's workload, and how it's performing"))
|
||||
// .append("\">")
|
||||
// .append(_("Jobs"))
|
||||
// .append(_t("Jobs"))
|
||||
// .append("</a>\n" +
|
||||
|
||||
if (!StatSummarizer.isDisabled()) {
|
||||
buf.append("<a href=\"/graphs\" target=\"_top\" title=\"")
|
||||
.append(_("Graph router performance"))
|
||||
.append(_t("Graph router performance"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Graphs")))
|
||||
.append(nbsp(_t("Graphs")))
|
||||
.append("</a>\n");
|
||||
}
|
||||
|
||||
buf.append("<a href=\"/stats\" target=\"_top\" title=\"")
|
||||
.append(_("Textual router performance statistics"))
|
||||
.append(_t("Textual router performance statistics"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Stats")))
|
||||
.append(nbsp(_t("Stats")))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/dns\" target=\"_top\" title=\"")
|
||||
.append(_("Manage your I2P hosts file here (I2P domain name resolution)"))
|
||||
.append(_t("Manage your I2P hosts file here (I2P domain name resolution)"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Addressbook")))
|
||||
.append(nbsp(_t("Addressbook")))
|
||||
.append("</a>\n" +
|
||||
|
||||
"<a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"")
|
||||
.append(_("Local Tunnels"))
|
||||
.append(_t("Local Tunnels"))
|
||||
.append("\">")
|
||||
.append(nbsp(_("Hidden Services Manager")))
|
||||
.append(nbsp(_t("Hidden Services Manager")))
|
||||
.append("</a>\n");
|
||||
|
||||
if (_context.getBooleanProperty(HelperBase.PROP_ADVANCED))
|
||||
@@ -254,44 +254,44 @@ public class SummaryBarRenderer {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/help\" target=\"_top\" title=\"")
|
||||
.append(_("I2P Router Help"))
|
||||
.append(_t("I2P Router Help"))
|
||||
.append("\">")
|
||||
.append(_("General"))
|
||||
.append(_t("General"))
|
||||
.append("</a></h3><hr class=\"b\">\n" +
|
||||
|
||||
"<table><tr>" +
|
||||
"<td align=\"left\"><b title=\"")
|
||||
.append(_("Your Local Identity is your unique I2P router identity, similar to an ip address but tailored to I2P. "))
|
||||
.append(_("Never disclose this to anyone, as it can reveal your real world ip."))
|
||||
.append(_t("Your Local Identity is your unique I2P router identity, similar to an ip address but tailored to I2P. "))
|
||||
.append(_t("Never disclose this to anyone, as it can reveal your real world ip."))
|
||||
.append("\">")
|
||||
.append(_("Local Identity"))
|
||||
.append(_t("Local Identity"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">" +
|
||||
"<a title=\"")
|
||||
.append(_("Your unique I2P router identity is"))
|
||||
.append(_t("Your unique I2P router identity is"))
|
||||
.append(' ')
|
||||
.append(_helper.getIdent())
|
||||
.append(", ")
|
||||
.append(_("never reveal it to anyone"))
|
||||
.append(_t("never reveal it to anyone"))
|
||||
.append("\" href=\"/netdb?r=.\" target=\"_top\">")
|
||||
.append(_("show"))
|
||||
.append(_t("show"))
|
||||
.append("</a></td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("The version of the I2P software we are running"))
|
||||
.append(_t("The version of the I2P software we are running"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Version"))
|
||||
.append(_t("Version"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_helper.getVersion())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("How long we've been running for this session"))
|
||||
.append(_t("How long we've been running for this session"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Uptime"))
|
||||
.append(_t("Uptime"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_helper.getUptime())
|
||||
@@ -304,20 +304,20 @@ public class SummaryBarRenderer {
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<table>" +
|
||||
"<tr title=\"")
|
||||
.append(_("The version of the I2P software we are running"))
|
||||
.append(_t("The version of the I2P software we are running"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Version"))
|
||||
.append(_t("Version"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_helper.getVersion())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("How long we've been running for this session"))
|
||||
.append(_t("How long we've been running for this session"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Uptime"))
|
||||
.append(_t("Uptime"))
|
||||
.append(":</b></td>" +
|
||||
"<td align=\"right\">")
|
||||
.append(_helper.getUptime())
|
||||
@@ -329,9 +329,9 @@ public class SummaryBarRenderer {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h4><a href=\"/confignet#help\" target=\"_top\" title=\"")
|
||||
.append(_("Help with configuring your firewall and router for optimal I2P performance"))
|
||||
.append(_t("Help with configuring your firewall and router for optimal I2P performance"))
|
||||
.append("\">")
|
||||
.append(_("Network"))
|
||||
.append(_t("Network"))
|
||||
.append(": ")
|
||||
.append(_helper.getReachability())
|
||||
.append("</a></h4>\n");
|
||||
@@ -340,9 +340,9 @@ public class SummaryBarRenderer {
|
||||
if ("ru".equals(Messages.getLanguage(_context)))
|
||||
buf.append("-ru");
|
||||
buf.append("\" target=\"_top\" title=\"")
|
||||
.append(_("See more information on the wiki"))
|
||||
.append(_t("See more information on the wiki"))
|
||||
.append("\">")
|
||||
.append(_("Warning: ECDSA is not available. Update your Java or OS"))
|
||||
.append(_t("Warning: ECDSA is not available. Update your Java or OS"))
|
||||
.append("</a></h4>\n");
|
||||
}
|
||||
return buf.toString();
|
||||
@@ -354,9 +354,9 @@ public class SummaryBarRenderer {
|
||||
if ("".equals(updateStatus)) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/configupdate\" target=\"_top\" title=\"")
|
||||
.append(_("Configure I2P Updates"))
|
||||
.append(_t("Configure I2P Updates"))
|
||||
.append("\">")
|
||||
.append(_("I2P Update"))
|
||||
.append(_t("I2P Update"))
|
||||
.append("</a></h3><hr class=\"b\">\n");
|
||||
buf.append(updateStatus);
|
||||
return buf.toString();
|
||||
@@ -373,18 +373,18 @@ public class SummaryBarRenderer {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/peers\" target=\"_top\" title=\"")
|
||||
.append(_("Show all current peer connections"))
|
||||
.append(_t("Show all current peer connections"))
|
||||
.append("\">")
|
||||
.append(_("Peers"))
|
||||
.append(_t("Peers"))
|
||||
.append("</a></h3><hr class=\"b\">\n" +
|
||||
|
||||
"<table>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("Peers we've been talking to in the last few minutes/last hour"))
|
||||
.append(_t("Peers we've been talking to in the last few minutes/last hour"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Active"))
|
||||
.append(_t("Active"))
|
||||
.append(":</b></td><td align=\"right\">");
|
||||
int active = _helper.getActivePeers();
|
||||
buf.append(active)
|
||||
@@ -393,37 +393,37 @@ public class SummaryBarRenderer {
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("The number of peers available for building client tunnels"))
|
||||
.append(_t("The number of peers available for building client tunnels"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Fast"))
|
||||
.append(_t("Fast"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getFastPeers())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("The number of peers available for building exploratory tunnels"))
|
||||
.append(_t("The number of peers available for building exploratory tunnels"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("High capacity"))
|
||||
.append(_t("High capacity"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getHighCapacityPeers())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("The number of peers available for network database inquiries"))
|
||||
.append(_t("The number of peers available for network database inquiries"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Integrated"))
|
||||
.append(_t("Integrated"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getWellIntegratedPeers())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("The total number of peers in our network database"))
|
||||
.append(_t("The total number of peers in our network database"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Known"))
|
||||
.append(_t("Known"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getAllPeers())
|
||||
.append("</td></tr>\n" +
|
||||
@@ -443,9 +443,9 @@ public class SummaryBarRenderer {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/config\" title=\"")
|
||||
.append(_("Configure router bandwidth allocation"))
|
||||
.append(_t("Configure router bandwidth allocation"))
|
||||
.append("\" target=\"_top\">")
|
||||
.append(_("Bandwidth in/out"))
|
||||
.append(_t("Bandwidth in/out"))
|
||||
.append("</a></h3><hr class=\"b\">" +
|
||||
"<table>\n" +
|
||||
|
||||
@@ -465,14 +465,14 @@ public class SummaryBarRenderer {
|
||||
|
||||
if (_context.router().getUptime() > 2*60*1000) {
|
||||
buf.append("<tr><td align=\"left\"><b>")
|
||||
.append(_("Total"))
|
||||
.append(_t("Total"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getLifetimeKBps())
|
||||
.append("Bps</td></tr>\n");
|
||||
}
|
||||
|
||||
buf.append("<tr><td align=\"left\"><b>")
|
||||
.append(_("Used"))
|
||||
.append(_t("Used"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getInboundTransferred())
|
||||
.append(SummaryHelper.THINSP)
|
||||
@@ -487,44 +487,44 @@ public class SummaryBarRenderer {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/tunnels\" target=\"_top\" title=\"")
|
||||
.append(_("View existing tunnels and tunnel build status"))
|
||||
.append(_t("View existing tunnels and tunnel build status"))
|
||||
.append("\">")
|
||||
.append(_("Tunnels"))
|
||||
.append(_t("Tunnels"))
|
||||
.append("</a></h3><hr class=\"b\">" +
|
||||
"<table>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("Used for building and testing tunnels, and communicating with floodfill peers"))
|
||||
.append(_t("Used for building and testing tunnels, and communicating with floodfill peers"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Exploratory"))
|
||||
.append(_t("Exploratory"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getInboundTunnels() + _helper.getOutboundTunnels())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("Tunnels we are using to provide or access services on the network"))
|
||||
.append(_t("Tunnels we are using to provide or access services on the network"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Client"))
|
||||
.append(_t("Client"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getInboundClientTunnels() + _helper.getOutboundClientTunnels())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("Tunnels we are participating in, directly contributing bandwidth to the network"))
|
||||
.append(_t("Tunnels we are participating in, directly contributing bandwidth to the network"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Participating"))
|
||||
.append(_t("Participating"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getParticipatingTunnels())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("The ratio of tunnel hops we provide to tunnel hops we use - a value greater than 1.00 indicates a positive contribution to the network"))
|
||||
.append(_t("The ratio of tunnel hops we provide to tunnel hops we use - a value greater than 1.00 indicates a positive contribution to the network"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Share ratio"))
|
||||
.append(_t("Share ratio"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getShareRatio())
|
||||
.append("</td></tr>\n" +
|
||||
@@ -537,46 +537,46 @@ public class SummaryBarRenderer {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/jobs\" target=\"_top\" title=\"")
|
||||
.append(_("What's in the router's job queue?"))
|
||||
.append(_t("What's in the router's job queue?"))
|
||||
.append("\">")
|
||||
.append(_("Congestion"))
|
||||
.append(_t("Congestion"))
|
||||
.append("</a></h3><hr class=\"b\">" +
|
||||
"<table>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("Indicates router performance"))
|
||||
.append(_t("Indicates router performance"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Job lag"))
|
||||
.append(_t("Job lag"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getJobLag())
|
||||
.append("</td></tr>\n" +
|
||||
|
||||
"<tr title=\"")
|
||||
.append(_("Indicates how quickly outbound messages to other I2P routers are sent"))
|
||||
.append(_t("Indicates how quickly outbound messages to other I2P routers are sent"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Message delay"))
|
||||
.append(_t("Message delay"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getMessageDelay())
|
||||
.append("</td></tr>\n");
|
||||
|
||||
if (!_context.getBooleanPropertyDefaultTrue("router.disableTunnelTesting")) {
|
||||
buf.append("<tr title=\"")
|
||||
.append(_("Round trip time for a tunnel test"))
|
||||
.append(_t("Round trip time for a tunnel test"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Tunnel lag"))
|
||||
.append(_t("Tunnel lag"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getTunnelLag())
|
||||
.append("</td></tr>\n");
|
||||
}
|
||||
|
||||
buf.append("<tr title=\"")
|
||||
.append(_("Queued requests from other routers to participate in tunnels"))
|
||||
.append(_t("Queued requests from other routers to participate in tunnels"))
|
||||
.append("\">" +
|
||||
"<td align=\"left\"><b>")
|
||||
.append(_("Backlog"))
|
||||
.append(_t("Backlog"))
|
||||
.append(":</b></td><td align=\"right\">")
|
||||
.append(_helper.getInboundBacklog())
|
||||
.append("</td></tr>\n" +
|
||||
@@ -589,7 +589,7 @@ public class SummaryBarRenderer {
|
||||
if (_helper == null) return "";
|
||||
StringBuilder buf = new StringBuilder(50);
|
||||
buf.append("<h4>")
|
||||
.append(_(_helper.getTunnelStatus()))
|
||||
.append(_t(_helper.getTunnelStatus()))
|
||||
.append("</h4>\n");
|
||||
return buf.toString();
|
||||
}
|
||||
@@ -612,7 +612,7 @@ public class SummaryBarRenderer {
|
||||
// Set up title and pre-headings stuff.
|
||||
//buf.append("<h3><a href=\"/configupdate\">")
|
||||
buf.append("<h3><a href=\"/news\">")
|
||||
.append(_("News & Updates"))
|
||||
.append(_t("News & Updates"))
|
||||
.append("</a></h3><hr class=\"b\"><div class=\"newsheadings\">\n");
|
||||
// Get news content.
|
||||
List<NewsEntry> entries = Collections.emptyList();
|
||||
@@ -647,11 +647,11 @@ public class SummaryBarRenderer {
|
||||
}
|
||||
buf.append("</ul>\n");
|
||||
//buf.append("<a href=\"/news\">")
|
||||
// .append(_("Show all news"))
|
||||
// .append(_t("Show all news"))
|
||||
// .append("</a>\n");
|
||||
} else {
|
||||
buf.append("<center><i>")
|
||||
.append(_("none"))
|
||||
.append(_t("none"))
|
||||
.append("</i></center>");
|
||||
}
|
||||
// Add post-headings stuff.
|
||||
@@ -661,7 +661,7 @@ public class SummaryBarRenderer {
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s) {
|
||||
private String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ public class SummaryHelper extends HelperBase {
|
||||
long diff = Math.abs(ms);
|
||||
if (diff < 3000)
|
||||
return "";
|
||||
return " (" + DataHelper.formatDuration2(diff) + " " + _("skew") + ")";
|
||||
return " (" + DataHelper.formatDuration2(diff) + " " + _t("skew") + ")";
|
||||
}
|
||||
**/
|
||||
|
||||
@@ -140,19 +140,19 @@ public class SummaryHelper extends HelperBase {
|
||||
return "VM Comm System";
|
||||
if (_context.router().getUptime() > 60*1000 && (!_context.router().gracefulShutdownInProgress()) &&
|
||||
!_context.clientManager().isAlive())
|
||||
return _("ERR-Client Manager I2CP Error - check logs"); // not a router problem but the user should know
|
||||
return _t("ERR-Client Manager I2CP Error - check logs"); // not a router problem but the user should know
|
||||
// Warn based on actual skew from peers, not update status, so if we successfully offset
|
||||
// the clock, we don't complain.
|
||||
//if (!_context.clock().getUpdatedSuccessfully())
|
||||
long skew = _context.commSystem().getFramedAveragePeerClockSkew(33);
|
||||
// Display the actual skew, not the offset
|
||||
if (Math.abs(skew) > 30*1000)
|
||||
return _("ERR-Clock Skew of {0}", DataHelper.formatDuration2(Math.abs(skew)));
|
||||
return _t("ERR-Clock Skew of {0}", DataHelper.formatDuration2(Math.abs(skew)));
|
||||
if (_context.router().isHidden())
|
||||
return _("Hidden");
|
||||
return _t("Hidden");
|
||||
RouterInfo routerInfo = _context.router().getRouterInfo();
|
||||
if (routerInfo == null)
|
||||
return _("Testing");
|
||||
return _t("Testing");
|
||||
|
||||
Status status = _context.commSystem().getStatus();
|
||||
switch (status) {
|
||||
@@ -164,37 +164,37 @@ public class SummaryHelper extends HelperBase {
|
||||
case IPV4_SNAT_IPV6_OK:
|
||||
RouterAddress ra = routerInfo.getTargetAddress("NTCP");
|
||||
if (ra == null)
|
||||
return _(status.toStatusString());
|
||||
return _t(status.toStatusString());
|
||||
byte[] ip = ra.getIP();
|
||||
if (ip == null)
|
||||
return _("ERR-Unresolved TCP Address");
|
||||
return _t("ERR-Unresolved TCP Address");
|
||||
// TODO set IPv6 arg based on configuration?
|
||||
if (TransportUtil.isPubliclyRoutable(ip, true))
|
||||
return _(status.toStatusString());
|
||||
return _("ERR-Private TCP Address");
|
||||
return _t(status.toStatusString());
|
||||
return _t("ERR-Private TCP Address");
|
||||
|
||||
case IPV4_SNAT_IPV6_UNKNOWN:
|
||||
case DIFFERENT:
|
||||
return _("ERR-SymmetricNAT");
|
||||
return _t("ERR-SymmetricNAT");
|
||||
|
||||
case REJECT_UNSOLICITED:
|
||||
case IPV4_DISABLED_IPV6_FIREWALLED:
|
||||
if (routerInfo.getTargetAddress("NTCP") != null)
|
||||
return _("WARN-Firewalled with Inbound TCP Enabled");
|
||||
return _t("WARN-Firewalled with Inbound TCP Enabled");
|
||||
// fall through...
|
||||
case IPV4_FIREWALLED_IPV6_OK:
|
||||
case IPV4_FIREWALLED_IPV6_UNKNOWN:
|
||||
if (((FloodfillNetworkDatabaseFacade)_context.netDb()).floodfillEnabled())
|
||||
return _("WARN-Firewalled and Floodfill");
|
||||
return _t("WARN-Firewalled and Floodfill");
|
||||
//if (_context.router().getRouterInfo().getCapabilities().indexOf('O') >= 0)
|
||||
// return _("WARN-Firewalled and Fast");
|
||||
return _(status.toStatusString());
|
||||
// return _t("WARN-Firewalled and Fast");
|
||||
return _t(status.toStatusString());
|
||||
|
||||
case DISCONNECTED:
|
||||
return _("Disconnected - check network cable");
|
||||
return _t("Disconnected - check network cable");
|
||||
|
||||
case HOSED:
|
||||
return _("ERR-UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart");
|
||||
return _t("ERR-UDP Port In Use - Set i2np.udp.internalPort=xxxx in advanced config and restart");
|
||||
|
||||
case UNKNOWN:
|
||||
case IPV4_UNKNOWN_IPV6_FIREWALLED:
|
||||
@@ -203,14 +203,14 @@ public class SummaryHelper extends HelperBase {
|
||||
ra = routerInfo.getTargetAddress("SSU");
|
||||
if (ra == null && _context.router().getUptime() > 5*60*1000) {
|
||||
if (getActivePeers() <= 0)
|
||||
return _("ERR-No Active Peers, Check Network Connection and Firewall");
|
||||
return _t("ERR-No Active Peers, Check Network Connection and Firewall");
|
||||
else if (_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_HOSTNAME) == null ||
|
||||
_context.getProperty(ConfigNetHelper.PROP_I2NP_NTCP_PORT) == null)
|
||||
return _("ERR-UDP Disabled and Inbound TCP host/port not set");
|
||||
return _t("ERR-UDP Disabled and Inbound TCP host/port not set");
|
||||
else
|
||||
return _("WARN-Firewalled with UDP Disabled");
|
||||
return _t("WARN-Firewalled with UDP Disabled");
|
||||
}
|
||||
return _(status.toStatusString());
|
||||
return _t(status.toStatusString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -434,8 +434,8 @@ public class SummaryHelper extends HelperBase {
|
||||
|
||||
StringBuilder buf = new StringBuilder(512);
|
||||
buf.append("<h3><a href=\"/i2ptunnelmgr\" target=\"_top\" title=\"")
|
||||
.append(_("Add/remove/edit & control your client and server tunnels"))
|
||||
.append("\">").append(_("Local Tunnels"))
|
||||
.append(_t("Add/remove/edit & control your client and server tunnels"))
|
||||
.append("\">").append(_t("Local Tunnels"))
|
||||
.append("</a></h3><hr class=\"b\"><div class=\"tunnels\">");
|
||||
if (!clients.isEmpty()) {
|
||||
Collections.sort(clients, new AlphaComparator());
|
||||
@@ -447,11 +447,11 @@ public class SummaryHelper extends HelperBase {
|
||||
|
||||
buf.append("<tr><td align=\"right\"><img src=\"/themes/console/images/");
|
||||
if (_context.clientManager().shouldPublishLeaseSet(h))
|
||||
buf.append("server.png\" alt=\"Server\" title=\"").append(_("Hidden Service")).append("\">");
|
||||
buf.append("server.png\" alt=\"Server\" title=\"").append(_t("Hidden Service")).append("\">");
|
||||
else
|
||||
buf.append("client.png\" alt=\"Client\" title=\"").append(_("Client")).append("\">");
|
||||
buf.append("client.png\" alt=\"Client\" title=\"").append(_t("Client")).append("\">");
|
||||
buf.append("</td><td align=\"left\"><b><a href=\"tunnels#").append(h.toBase64().substring(0,4));
|
||||
buf.append("\" target=\"_top\" title=\"").append(_("Show tunnels")).append("\">");
|
||||
buf.append("\" target=\"_top\" title=\"").append(_t("Show tunnels")).append("\">");
|
||||
if (name.length() <= 20)
|
||||
buf.append(DataHelper.escapeHTML(name));
|
||||
else
|
||||
@@ -462,20 +462,20 @@ public class SummaryHelper extends HelperBase {
|
||||
long timeToExpire = ls.getEarliestLeaseDate() - _context.clock().now();
|
||||
if (timeToExpire < 0) {
|
||||
// red or yellow light
|
||||
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_("Rebuilding")).append("…\" title=\"").append(_("Leases expired")).append(" ").append(DataHelper.formatDuration2(0-timeToExpire));
|
||||
buf.append(" ").append(_("ago")).append(". ").append(_("Rebuilding")).append("…\"></td></tr>\n");
|
||||
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_t("Rebuilding")).append("…\" title=\"").append(_t("Leases expired")).append(" ").append(DataHelper.formatDuration2(0-timeToExpire));
|
||||
buf.append(" ").append(_t("ago")).append(". ").append(_t("Rebuilding")).append("…\"></td></tr>\n");
|
||||
} else {
|
||||
// green light
|
||||
buf.append("<td><img src=\"/themes/console/images/local_up.png\" alt=\"Ready\" title=\"").append(_("Ready")).append("\"></td></tr>\n");
|
||||
buf.append("<td><img src=\"/themes/console/images/local_up.png\" alt=\"Ready\" title=\"").append(_t("Ready")).append("\"></td></tr>\n");
|
||||
}
|
||||
} else {
|
||||
// yellow light
|
||||
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_("Building")).append("…\" title=\"").append(_("Building tunnels")).append("…\"></td></tr>\n");
|
||||
buf.append("<td><img src=\"/themes/console/images/local_inprogress.png\" alt=\"").append(_t("Building")).append("…\" title=\"").append(_t("Building tunnels")).append("…\"></td></tr>\n");
|
||||
}
|
||||
}
|
||||
buf.append("</table>");
|
||||
} else {
|
||||
buf.append("<center><i>").append(_("none")).append("</i></center>");
|
||||
buf.append("<center><i>").append(_t("none")).append("</i></center>");
|
||||
}
|
||||
buf.append("</div>\n");
|
||||
return buf.toString();
|
||||
@@ -486,7 +486,7 @@ public class SummaryHelper extends HelperBase {
|
||||
* Inner class, can't be Serializable
|
||||
*/
|
||||
private class AlphaComparator implements Comparator<Destination> {
|
||||
private final String xsc = _("shared clients");
|
||||
private final String xsc = _t("shared clients");
|
||||
|
||||
public int compare(Destination lhs, Destination rhs) {
|
||||
String lname = getName(lhs);
|
||||
@@ -511,9 +511,9 @@ public class SummaryHelper extends HelperBase {
|
||||
if (name == null)
|
||||
name = d.calculateHash().toBase64().substring(0,6);
|
||||
else
|
||||
name = _(name);
|
||||
name = _t(name);
|
||||
} else {
|
||||
name = _(name);
|
||||
name = _t(name);
|
||||
}
|
||||
return name;
|
||||
}
|
||||
@@ -712,12 +712,12 @@ public class SummaryHelper extends HelperBase {
|
||||
buf.append("<hr>");
|
||||
else
|
||||
needSpace = true;
|
||||
buf.append("<h4><b>").append(_("Update downloaded")).append("<br>");
|
||||
buf.append("<h4><b>").append(_t("Update downloaded")).append("<br>");
|
||||
if (_context.hasWrapper())
|
||||
buf.append(_("Click Restart to install"));
|
||||
buf.append(_t("Click Restart to install"));
|
||||
else
|
||||
buf.append(_("Click Shutdown and restart to install"));
|
||||
buf.append(' ').append(_("Version {0}", DataHelper.escapeHTML(dver)));
|
||||
buf.append(_t("Click Shutdown and restart to install"));
|
||||
buf.append(' ').append(_t("Version {0}", DataHelper.escapeHTML(dver)));
|
||||
buf.append("</b></h4>");
|
||||
}
|
||||
boolean avail = updateAvailable();
|
||||
@@ -731,8 +731,8 @@ public class SummaryHelper extends HelperBase {
|
||||
buf.append("<hr>");
|
||||
else
|
||||
needSpace = true;
|
||||
buf.append("<h4><b>").append(_("Update available")).append(":<br>");
|
||||
buf.append(_("Version {0}", getUpdateVersion())).append("<br>");
|
||||
buf.append("<h4><b>").append(_t("Update available")).append(":<br>");
|
||||
buf.append(_t("Version {0}", getUpdateVersion())).append("<br>");
|
||||
buf.append(constraint).append("</b></h4>");
|
||||
avail = false;
|
||||
}
|
||||
@@ -755,7 +755,7 @@ public class SummaryHelper extends HelperBase {
|
||||
if (avail) {
|
||||
buf.append("<button type=\"submit\" class=\"download\" name=\"updateAction\" value=\"signed\" >")
|
||||
// Note to translators: parameter is a version, e.g. "0.8.4"
|
||||
.append(_("Download {0} Update", getUpdateVersion()))
|
||||
.append(_t("Download {0} Update", getUpdateVersion()))
|
||||
.append("</button><br>\n");
|
||||
}
|
||||
if (devSU3Avail) {
|
||||
@@ -763,7 +763,7 @@ public class SummaryHelper extends HelperBase {
|
||||
// Note to translators: parameter is a router version, e.g. "0.9.19-16"
|
||||
// <br> is optional, to help the browser make the lines even in the button
|
||||
// If the translation is shorter than the English, you should probably not include <br>
|
||||
.append(_("Download Signed<br>Development Update<br>{0}", getDevSU3UpdateVersion()))
|
||||
.append(_t("Download Signed<br>Development Update<br>{0}", getDevSU3UpdateVersion()))
|
||||
.append("</button><br>\n");
|
||||
}
|
||||
if (unsignedAvail) {
|
||||
@@ -771,7 +771,7 @@ public class SummaryHelper extends HelperBase {
|
||||
// Note to translators: parameter is a date and time, e.g. "02-Mar 20:34 UTC"
|
||||
// <br> is optional, to help the browser make the lines even in the button
|
||||
// If the translation is shorter than the English, you should probably not include <br>
|
||||
.append(_("Download Unsigned<br>Update {0}", getUnsignedUpdateVersion()))
|
||||
.append(_t("Download Unsigned<br>Update {0}", getUnsignedUpdateVersion()))
|
||||
.append("</button><br>\n");
|
||||
}
|
||||
buf.append("</form>\n");
|
||||
@@ -795,9 +795,9 @@ public class SummaryHelper extends HelperBase {
|
||||
StringBuilder buf = new StringBuilder(256);
|
||||
if (showFirewallWarning()) {
|
||||
buf.append("<h4><a href=\"/confignet\" target=\"_top\" title=\"")
|
||||
.append(_("Help with firewall configuration"))
|
||||
.append(_t("Help with firewall configuration"))
|
||||
.append("\">")
|
||||
.append(_("Check network connection and NAT/firewall"))
|
||||
.append(_t("Check network connection and NAT/firewall"))
|
||||
.append("</a></h4>");
|
||||
}
|
||||
|
||||
@@ -816,7 +816,7 @@ public class SummaryHelper extends HelperBase {
|
||||
String uri = getRequestURI();
|
||||
buf.append("<p><form action=\"").append(uri).append("\" method=\"POST\">\n");
|
||||
buf.append("<input type=\"hidden\" name=\"reseedNonce\" value=\"").append(nonce).append("\" >\n");
|
||||
buf.append("<button type=\"submit\" class=\"reload\" value=\"Reseed\" >").append(_("Reseed")).append("</button></form></p>\n");
|
||||
buf.append("<button type=\"submit\" class=\"reload\" value=\"Reseed\" >").append(_t("Reseed")).append("</button></form></p>\n");
|
||||
}
|
||||
}
|
||||
// If a new reseed ain't running, and the last reseed had errors, show error message
|
||||
@@ -901,18 +901,18 @@ public class SummaryHelper extends HelperBase {
|
||||
|
||||
StringBuilder buf = new StringBuilder(2048);
|
||||
buf.append("<table class=\"sidebarconf\"><tr><th>")
|
||||
.append(_("Remove"))
|
||||
.append(_t("Remove"))
|
||||
.append("</th><th>")
|
||||
.append(_("Name"))
|
||||
.append(_t("Name"))
|
||||
.append("</th><th colspan=\"2\">")
|
||||
.append(_("Order"))
|
||||
.append(_t("Order"))
|
||||
.append("</th></tr>\n");
|
||||
for (String section : sections) {
|
||||
int i = sections.indexOf(section);
|
||||
buf.append("<tr><td align=\"center\"><input type=\"checkbox\" class=\"optbox\" name=\"delete_")
|
||||
.append(i)
|
||||
.append("\"></td><td align=\"left\">")
|
||||
.append(_(sectionNames.get(section)))
|
||||
.append(_t(sectionNames.get(section)))
|
||||
.append("</td><td align=\"right\"><input type=\"hidden\" name=\"order_")
|
||||
.append(i).append('_').append(section)
|
||||
.append("\" value=\"")
|
||||
@@ -922,22 +922,22 @@ public class SummaryHelper extends HelperBase {
|
||||
buf.append("<button type=\"submit\" class=\"buttonTop\" name=\"action\" value=\"move_")
|
||||
.append(i)
|
||||
.append("_top\"><img alt=\"")
|
||||
.append(_("Top"))
|
||||
.append(_t("Top"))
|
||||
.append("\" src=\"")
|
||||
.append(imgPath)
|
||||
.append("move_top.png")
|
||||
.append("\" title=\"")
|
||||
.append(_("Move to top"))
|
||||
.append(_t("Move to top"))
|
||||
.append("\"/></button>");
|
||||
buf.append("<button type=\"submit\" class=\"buttonUp\" name=\"action\" value=\"move_")
|
||||
.append(i)
|
||||
.append("_up\"><img alt=\"")
|
||||
.append(_("Up"))
|
||||
.append(_t("Up"))
|
||||
.append("\" src=\"")
|
||||
.append(imgPath)
|
||||
.append("move_up.png")
|
||||
.append("\" title=\"")
|
||||
.append(_("Move up"))
|
||||
.append(_t("Move up"))
|
||||
.append("\"/></button>");
|
||||
}
|
||||
buf.append("</td><td align=\"left\">");
|
||||
@@ -945,34 +945,34 @@ public class SummaryHelper extends HelperBase {
|
||||
buf.append("<button type=\"submit\" class=\"buttonDown\" name=\"action\" value=\"move_")
|
||||
.append(i)
|
||||
.append("_down\"><img alt=\"")
|
||||
.append(_("Down"))
|
||||
.append(_t("Down"))
|
||||
.append("\" src=\"")
|
||||
.append(imgPath)
|
||||
.append("move_down.png")
|
||||
.append("\" title=\"")
|
||||
.append(_("Move down"))
|
||||
.append(_t("Move down"))
|
||||
.append("\"/></button>");
|
||||
buf.append("<button type=\"submit\" class=\"buttonBottom\" name=\"action\" value=\"move_")
|
||||
.append(i)
|
||||
.append("_bottom\"><img alt=\"")
|
||||
.append(_("Bottom"))
|
||||
.append(_t("Bottom"))
|
||||
.append("\" src=\"")
|
||||
.append(imgPath)
|
||||
.append("move_bottom.png")
|
||||
.append("\" title=\"")
|
||||
.append(_("Move to bottom"))
|
||||
.append(_t("Move to bottom"))
|
||||
.append("\"/></button>");
|
||||
}
|
||||
buf.append("</td></tr>\n");
|
||||
}
|
||||
buf.append("<tr><td align=\"center\">" +
|
||||
"<input type=\"submit\" name=\"action\" class=\"delete\" value=\"")
|
||||
.append(_("Delete selected"))
|
||||
.append(_t("Delete selected"))
|
||||
.append("\"></td><td align=\"left\"><b>")
|
||||
.append(_("Add")).append(":</b> " +
|
||||
.append(_t("Add")).append(":</b> " +
|
||||
"<select name=\"name\">\n" +
|
||||
"<option value=\"\" selected=\"selected\">")
|
||||
.append(_("Select a section to add"))
|
||||
.append(_t("Select a section to add"))
|
||||
.append("</option>\n");
|
||||
|
||||
for (String s : sortedSections) {
|
||||
@@ -986,7 +986,7 @@ public class SummaryHelper extends HelperBase {
|
||||
.append("\"></td>" +
|
||||
"<td align=\"center\" colspan=\"2\">" +
|
||||
"<input type=\"submit\" name=\"action\" class=\"add\" value=\"")
|
||||
.append(_("Add item"))
|
||||
.append(_t("Add item"))
|
||||
.append("\"></td></tr>")
|
||||
.append("</table>\n");
|
||||
return buf.toString();
|
||||
|
||||
@@ -139,9 +139,9 @@ class SummaryRenderer {
|
||||
else
|
||||
p = DataHelper.formatDuration2(period).replace(" ", " ");
|
||||
if (showEvents)
|
||||
title = name + ' ' + _("events in {0}", p);
|
||||
title = name + ' ' + _t("events in {0}", p);
|
||||
else
|
||||
title = name + ' ' + _("averaged for {0}", p);
|
||||
title = name + ' ' + _t("averaged for {0}", p);
|
||||
def.setTitle(title);
|
||||
}
|
||||
String path = _listener.getData().getPath();
|
||||
@@ -151,7 +151,7 @@ class SummaryRenderer {
|
||||
if (showEvents) {
|
||||
// include the average event count on the plot
|
||||
plotName = dsNames[1];
|
||||
descr = _("Events per period");
|
||||
descr = _t("Events per period");
|
||||
} else {
|
||||
// include the average value
|
||||
plotName = dsNames[0];
|
||||
@@ -159,12 +159,12 @@ class SummaryRenderer {
|
||||
// (there are over 500 of them)
|
||||
// but the descriptions for the default graphs are tagged in
|
||||
// Strings.java
|
||||
descr = _(_listener.getRate().getRateStat().getDescription());
|
||||
descr = _t(_listener.getRate().getRateStat().getDescription());
|
||||
}
|
||||
|
||||
//long started = ((RouterContext)_context).router().getWhenStarted();
|
||||
//if (started > start && started < end)
|
||||
// def.vrule(started / 1000, RESTART_BAR_COLOR, _("Restart"), 4.0f);
|
||||
// def.vrule(started / 1000, RESTART_BAR_COLOR, _t("Restart"), 4.0f);
|
||||
|
||||
def.datasource(plotName, path, plotName, SummaryListener.CF, _listener.getBackendName());
|
||||
if (descr.length() > 0) {
|
||||
@@ -173,22 +173,22 @@ class SummaryRenderer {
|
||||
def.area(plotName, Color.BLUE);
|
||||
}
|
||||
if (!hideLegend) {
|
||||
def.gprint(plotName, SummaryListener.CF, _("avg") + ": %.2f %s");
|
||||
def.gprint(plotName, "MAX", ' ' + _("max") + ": %.2f %S");
|
||||
def.gprint(plotName, "LAST", ' ' + _("now") + ": %.2f %S\\r");
|
||||
def.gprint(plotName, SummaryListener.CF, _t("avg") + ": %.2f %s");
|
||||
def.gprint(plotName, "MAX", ' ' + _t("max") + ": %.2f %S");
|
||||
def.gprint(plotName, "LAST", ' ' + _t("now") + ": %.2f %S\\r");
|
||||
}
|
||||
String plotName2 = null;
|
||||
if (lsnr2 != null) {
|
||||
String dsNames2[] = lsnr2.getData().getDsNames();
|
||||
plotName2 = dsNames2[0];
|
||||
String path2 = lsnr2.getData().getPath();
|
||||
String descr2 = _(lsnr2.getRate().getRateStat().getDescription());
|
||||
String descr2 = _t(lsnr2.getRate().getRateStat().getDescription());
|
||||
def.datasource(plotName2, path2, plotName2, SummaryListener.CF, lsnr2.getBackendName());
|
||||
def.line(plotName2, Color.RED, descr2 + "\\r", 3);
|
||||
if (!hideLegend) {
|
||||
def.gprint(plotName2, SummaryListener.CF, _("avg") + ": %.2f %s");
|
||||
def.gprint(plotName2, "MAX", ' ' + _("max") + ": %.2f %S");
|
||||
def.gprint(plotName2, "LAST", ' ' + _("now") + ": %.2f %S\\r");
|
||||
def.gprint(plotName2, SummaryListener.CF, _t("avg") + ": %.2f %s");
|
||||
def.gprint(plotName2, "MAX", ' ' + _t("max") + ": %.2f %S");
|
||||
def.gprint(plotName2, "LAST", ' ' + _t("now") + ": %.2f %S\\r");
|
||||
}
|
||||
}
|
||||
if (!hideLegend) {
|
||||
@@ -198,7 +198,7 @@ class SummaryRenderer {
|
||||
for (Map.Entry<Long, String> event : events.entrySet()) {
|
||||
long started = event.getKey().longValue();
|
||||
if (started > start && started < end) {
|
||||
String legend = _("Restart") + ' ' + sdf.format(new Date(started)) + " UTC " + event.getValue() + "\\r";
|
||||
String legend = _t("Restart") + ' ' + sdf.format(new Date(started)) + " UTC " + event.getValue() + "\\r";
|
||||
def.vrule(started / 1000, RESTART_BAR_COLOR, legend, 4.0f);
|
||||
}
|
||||
}
|
||||
@@ -271,7 +271,7 @@ class SummaryRenderer {
|
||||
private static final boolean IS_WIN = SystemVersion.isWindows();
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s) {
|
||||
private String _t(String s) {
|
||||
// the RRD font doesn't have zh chars, at least on my system
|
||||
// Works on 1.5.9 except on windows
|
||||
if (IS_WIN && "zh".equals(Messages.getLanguage(_context)))
|
||||
@@ -282,7 +282,7 @@ class SummaryRenderer {
|
||||
/**
|
||||
* translate a string with a parameter
|
||||
*/
|
||||
private String _(String s, String o) {
|
||||
private String _t(String s, String o) {
|
||||
// the RRD font doesn't have zh chars, at least on my system
|
||||
// Works on 1.5.9 except on windows
|
||||
if (IS_WIN && "zh".equals(Messages.getLanguage(_context)))
|
||||
|
||||
@@ -33,7 +33,7 @@ public class TunnelRenderer {
|
||||
}
|
||||
|
||||
public void renderStatusHTML(Writer out) throws IOException {
|
||||
out.write("<div class=\"wideload\"><h2><a name=\"exploratory\" ></a>" + _("Exploratory tunnels") + " (<a href=\"/configtunnels#exploratory\">" + _("configure") + "</a>)</h2>\n");
|
||||
out.write("<div class=\"wideload\"><h2><a name=\"exploratory\" ></a>" + _t("Exploratory tunnels") + " (<a href=\"/configtunnels#exploratory\">" + _t("configure") + "</a>)</h2>\n");
|
||||
renderPool(out, _context.tunnelManager().getInboundExploratoryPool(), _context.tunnelManager().getOutboundExploratoryPool());
|
||||
|
||||
List<Hash> destinations = null;
|
||||
@@ -57,20 +57,20 @@ public class TunnelRenderer {
|
||||
if (name == null)
|
||||
name = client.toBase64().substring(0,4);
|
||||
out.write("<h2><a name=\"" + client.toBase64().substring(0,4)
|
||||
+ "\" ></a>" + _("Client tunnels for") + ' ' + DataHelper.escapeHTML(_(name)));
|
||||
+ "\" ></a>" + _t("Client tunnels for") + ' ' + DataHelper.escapeHTML(_t(name)));
|
||||
if (isLocal)
|
||||
out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _("configure") + "</a>)</h2>\n");
|
||||
out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _t("configure") + "</a>)</h2>\n");
|
||||
else
|
||||
out.write(" (" + _("dead") + ")</h2>\n");
|
||||
out.write(" (" + _t("dead") + ")</h2>\n");
|
||||
renderPool(out, in, outPool);
|
||||
}
|
||||
|
||||
List<HopConfig> participating = _context.tunnelDispatcher().listParticipatingTunnels();
|
||||
Collections.sort(participating, new TunnelComparator());
|
||||
out.write("<h2><a name=\"participating\"></a>" + _("Participating tunnels") + "</h2><table>\n");
|
||||
out.write("<tr><th>" + _("Receive on") + "</th><th>" + _("From") + "</th><th>"
|
||||
+ _("Send on") + "</th><th>" + _("To") + "</th><th>" + _("Expiration") + "</th>"
|
||||
+ "<th>" + _("Usage") + "</th><th>" + _("Rate") + "</th><th>" + _("Role") + "</th></tr>\n");
|
||||
out.write("<h2><a name=\"participating\"></a>" + _t("Participating tunnels") + "</h2><table>\n");
|
||||
out.write("<tr><th>" + _t("Receive on") + "</th><th>" + _t("From") + "</th><th>"
|
||||
+ _t("Send on") + "</th><th>" + _t("To") + "</th><th>" + _t("Expiration") + "</th>"
|
||||
+ "<th>" + _t("Usage") + "</th><th>" + _t("Rate") + "</th><th>" + _t("Role") + "</th></tr>\n");
|
||||
long processed = 0;
|
||||
RateStat rs = _context.statManager().getRate("tunnel.participatingMessageCount");
|
||||
if (rs != null)
|
||||
@@ -108,7 +108,7 @@ public class TunnelRenderer {
|
||||
if (timeLeft > 0)
|
||||
out.write("<td class=\"cells\" align=\"center\">" + DataHelper.formatDuration2(timeLeft) + "</td>");
|
||||
else
|
||||
out.write("<td class=\"cells\" align=\"center\">(" + _("grace period") + ")</td>");
|
||||
out.write("<td class=\"cells\" align=\"center\">(" + _t("grace period") + ")</td>");
|
||||
out.write("<td class=\"cells\" align=\"center\">" + cfg.getProcessedMessagesCount() + " KB</td>");
|
||||
int lifetime = (int) ((_context.clock().now() - cfg.getCreation()) / 1000);
|
||||
if (lifetime <= 0)
|
||||
@@ -118,18 +118,18 @@ public class TunnelRenderer {
|
||||
int bps = 1024 * cfg.getProcessedMessagesCount() / lifetime;
|
||||
out.write("<td class=\"cells\" align=\"center\">" + bps + " Bps</td>");
|
||||
if (cfg.getSendTo() == null)
|
||||
out.write("<td class=\"cells\" align=\"center\">" + _("Outbound Endpoint") + "</td>");
|
||||
out.write("<td class=\"cells\" align=\"center\">" + _t("Outbound Endpoint") + "</td>");
|
||||
else if (cfg.getReceiveFrom() == null)
|
||||
out.write("<td class=\"cells\" align=\"center\">" + _("Inbound Gateway") + "</td>");
|
||||
out.write("<td class=\"cells\" align=\"center\">" + _t("Inbound Gateway") + "</td>");
|
||||
else
|
||||
out.write("<td class=\"cells\" align=\"center\">" + _("Participant") + "</td>");
|
||||
out.write("<td class=\"cells\" align=\"center\">" + _t("Participant") + "</td>");
|
||||
out.write("</tr>\n");
|
||||
}
|
||||
out.write("</table>\n");
|
||||
if (displayed > DISPLAY_LIMIT)
|
||||
out.write("<div class=\"statusnotes\"><b>" + _("Limited display to the {0} tunnels with the highest usage", DISPLAY_LIMIT) + "</b></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><b>" + _("Inactive participating tunnels") + ": " + inactive + "</b></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><b>" + _("Lifetime bandwidth usage") + ": " + DataHelper.formatSize2(processed*1024) + "B</b></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><b>" + _t("Limited display to the {0} tunnels with the highest usage", DISPLAY_LIMIT) + "</b></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><b>" + _t("Inactive participating tunnels") + ": " + inactive + "</b></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><b>" + _t("Lifetime bandwidth usage") + ": " + DataHelper.formatSize2(processed*1024) + "B</b></div>\n");
|
||||
//renderPeers(out);
|
||||
out.write("</div>");
|
||||
}
|
||||
@@ -159,16 +159,16 @@ public class TunnelRenderer {
|
||||
if (info.getLength() > maxLength)
|
||||
maxLength = info.getLength();
|
||||
}
|
||||
out.write("<table><tr><th>" + _("In/Out") + "</th><th>" + _("Expiry") + "</th><th>" + _("Usage") + "</th><th>" + _("Gateway") + "</th>");
|
||||
out.write("<table><tr><th>" + _t("In/Out") + "</th><th>" + _t("Expiry") + "</th><th>" + _t("Usage") + "</th><th>" + _t("Gateway") + "</th>");
|
||||
if (maxLength > 3) {
|
||||
out.write("<th align=\"center\" colspan=\"" + (maxLength - 2));
|
||||
out.write("\">" + _("Participants") + "</th>");
|
||||
out.write("\">" + _t("Participants") + "</th>");
|
||||
}
|
||||
else if (maxLength == 3) {
|
||||
out.write("<th>" + _("Participant") + "</th>");
|
||||
out.write("<th>" + _t("Participant") + "</th>");
|
||||
}
|
||||
if (maxLength > 1) {
|
||||
out.write("<th>" + _("Endpoint") + "</th>");
|
||||
out.write("<th>" + _t("Endpoint") + "</th>");
|
||||
}
|
||||
out.write("</tr>\n");
|
||||
for (int i = 0; i < tunnels.size(); i++) {
|
||||
@@ -208,22 +208,22 @@ public class TunnelRenderer {
|
||||
if (in != null) {
|
||||
List pending = in.listPending();
|
||||
if (!pending.isEmpty()) {
|
||||
out.write("<div class=\"statusnotes\"><center><b>" + _("Build in progress") + ": " + pending.size() + " " + _("inbound") + "</b></center></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><center><b>" + _t("Build in progress") + ": " + pending.size() + " " + _t("inbound") + "</b></center></div>\n");
|
||||
live += pending.size();
|
||||
}
|
||||
}
|
||||
if (outPool != null) {
|
||||
List pending = outPool.listPending();
|
||||
if (!pending.isEmpty()) {
|
||||
out.write("<div class=\"statusnotes\"><center><b>" + _("Build in progress") + ": " + pending.size() + " " + _("outbound") + "</b></center></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><center><b>" + _t("Build in progress") + ": " + pending.size() + " " + _t("outbound") + "</b></center></div>\n");
|
||||
live += pending.size();
|
||||
}
|
||||
}
|
||||
if (live <= 0)
|
||||
out.write("<div class=\"statusnotes\"><center><b>" + _("No tunnels; waiting for the grace period to end.") + "</b></center></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><center><b>" + _("Lifetime bandwidth usage") + ": " +
|
||||
DataHelper.formatSize2(processedIn*1024) + "B " + _("in") + ", " +
|
||||
DataHelper.formatSize2(processedOut*1024) + "B " + _("out") + "</b></center></div>");
|
||||
out.write("<div class=\"statusnotes\"><center><b>" + _t("No tunnels; waiting for the grace period to end.") + "</b></center></div>\n");
|
||||
out.write("<div class=\"statusnotes\"><center><b>" + _t("Lifetime bandwidth usage") + ": " +
|
||||
DataHelper.formatSize2(processedIn*1024) + "B " + _t("in") + ", " +
|
||||
DataHelper.formatSize2(processedOut*1024) + "B " + _t("out") + "</b></center></div>");
|
||||
}
|
||||
|
||||
/****
|
||||
@@ -241,8 +241,8 @@ public class TunnelRenderer {
|
||||
List<Hash> peerList = new ArrayList(peers);
|
||||
Collections.sort(peerList, new CountryComparator(this._context.commSystem()));
|
||||
|
||||
out.write("<h2><a name=\"peers\"></a>" + _("Tunnel Counts By Peer") + "</h2>\n");
|
||||
out.write("<table><tr><th>" + _("Peer") + "</th><th>" + _("Our Tunnels") + "</th><th>" + _("% of total") + "</th><th>" + _("Participating Tunnels") + "</th><th>" + _("% of total") + "</th></tr>\n");
|
||||
out.write("<h2><a name=\"peers\"></a>" + _t("Tunnel Counts By Peer") + "</h2>\n");
|
||||
out.write("<table><tr><th>" + _t("Peer") + "</th><th>" + _t("Our Tunnels") + "</th><th>" + _t("% of total") + "</th><th>" + _t("Participating Tunnels") + "</th><th>" + _t("% of total") + "</th></tr>\n");
|
||||
for (Hash h : peerList) {
|
||||
out.write("<tr> <td class=\"cells\" align=\"center\">");
|
||||
out.write(netDbLink(h));
|
||||
@@ -260,7 +260,7 @@ public class TunnelRenderer {
|
||||
out.write('0');
|
||||
out.write('\n');
|
||||
}
|
||||
out.write("<tr class=\"tablefooter\"> <td align=\"center\"><b>" + _("Totals") + "</b> <td align=\"center\"><b>" + tunnelCount);
|
||||
out.write("<tr class=\"tablefooter\"> <td align=\"center\"><b>" + _t("Totals") + "</b> <td align=\"center\"><b>" + tunnelCount);
|
||||
out.write("</b> <td> </td> <td align=\"center\"><b>" + partCount);
|
||||
out.write("</b> <td> </td></tr></table></div>\n");
|
||||
}
|
||||
@@ -343,12 +343,12 @@ public class TunnelRenderer {
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private String _(String s) {
|
||||
private String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
public String _(String s, Object o) {
|
||||
public String _t(String s, Object o) {
|
||||
return Messages.getString(s, o, _context);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,76 +9,76 @@ package dummy;
|
||||
class Dummy {
|
||||
void dummy {
|
||||
// wars for ConfigClientsHelper
|
||||
_("addressbook");
|
||||
_("i2psnark");
|
||||
_("i2ptunnel");
|
||||
_("susimail");
|
||||
_("susidns");
|
||||
_("routerconsole");
|
||||
_t("addressbook");
|
||||
_t("i2psnark");
|
||||
_t("i2ptunnel");
|
||||
_t("susimail");
|
||||
_t("susidns");
|
||||
_t("routerconsole");
|
||||
|
||||
// clients, taken from clients.config, for ConfigClientsHelper
|
||||
// note that if the wording changes in clients.config, we have to
|
||||
// keep the old string here as well for existing installs
|
||||
_("Web console");
|
||||
_("SAM application bridge");
|
||||
_("Application tunnels");
|
||||
_("My eepsite web server");
|
||||
_("I2P webserver (eepsite)");
|
||||
_("Browser launch at startup");
|
||||
_("BOB application bridge");
|
||||
_("I2P Router Console");
|
||||
_("Open Router Console in web browser at startup");
|
||||
_t("Web console");
|
||||
_t("SAM application bridge");
|
||||
_t("Application tunnels");
|
||||
_t("My eepsite web server");
|
||||
_t("I2P webserver (eepsite)");
|
||||
_t("Browser launch at startup");
|
||||
_t("BOB application bridge");
|
||||
_t("I2P Router Console");
|
||||
_t("Open Router Console in web browser at startup");
|
||||
|
||||
// tunnel nicknames, taken from i2ptunnel.config so they will display
|
||||
// nicely under 'local destinations' in the summary bar
|
||||
// note that if the wording changes in i2ptunnel.config, we have to
|
||||
// keep the old string here as well for existing installs
|
||||
_("shared clients");
|
||||
_("shared clients (DSA)");
|
||||
_("IRC proxy");
|
||||
_("eepsite");
|
||||
_("I2P webserver");
|
||||
_("HTTP Proxy");
|
||||
_t("shared clients");
|
||||
_t("shared clients (DSA)");
|
||||
_t("IRC proxy");
|
||||
_t("eepsite");
|
||||
_t("I2P webserver");
|
||||
_t("HTTP Proxy");
|
||||
// older names for pre-0.7.4 installs
|
||||
_("eepProxy");
|
||||
_("ircProxy");
|
||||
_t("eepProxy");
|
||||
_t("ircProxy");
|
||||
// hardcoded in i2psnark
|
||||
_("I2PSnark");
|
||||
_t("I2PSnark");
|
||||
// hardcoded in iMule?
|
||||
_("iMule");
|
||||
_t("iMule");
|
||||
|
||||
|
||||
// standard themes for ConfigUIHelper
|
||||
_("classic");
|
||||
_("dark");
|
||||
_("light");
|
||||
_("midnight");
|
||||
_t("classic");
|
||||
_t("dark");
|
||||
_t("light");
|
||||
_t("midnight");
|
||||
|
||||
// stat groups for stats.jsp
|
||||
_("Bandwidth");
|
||||
_("BandwidthLimiter");
|
||||
_("ClientMessages");
|
||||
_("Encryption");
|
||||
_("i2cp");
|
||||
_("I2PTunnel");
|
||||
_("InNetPool");
|
||||
_("JobQueue");
|
||||
_("NetworkDatabase");
|
||||
_("ntcp");
|
||||
_("Peers");
|
||||
_("Router");
|
||||
_("Stream");
|
||||
_("Throttle");
|
||||
_("Transport");
|
||||
_("Tunnels");
|
||||
_("udp");
|
||||
_t("Bandwidth");
|
||||
_t("BandwidthLimiter");
|
||||
_t("ClientMessages");
|
||||
_t("Encryption");
|
||||
_t("i2cp");
|
||||
_t("I2PTunnel");
|
||||
_t("InNetPool");
|
||||
_t("JobQueue");
|
||||
_t("NetworkDatabase");
|
||||
_t("ntcp");
|
||||
_t("Peers");
|
||||
_t("Router");
|
||||
_t("Stream");
|
||||
_t("Throttle");
|
||||
_t("Transport");
|
||||
_t("Tunnels");
|
||||
_t("udp");
|
||||
|
||||
// parameters in transport addresses (netdb.jsp)
|
||||
// may or may not be worth translating
|
||||
_("host");
|
||||
_("key");
|
||||
_("port");
|
||||
_t("host");
|
||||
_t("key");
|
||||
_t("port");
|
||||
// capabilities
|
||||
_("caps");
|
||||
_t("caps");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user