From b4d83b18faa94ecf4853cd18c82a41ac596c276c Mon Sep 17 00:00:00 2001 From: zzz Date: Thu, 29 Oct 2009 23:22:51 +0000 Subject: [PATCH] tag and script fixups --- apps/routerconsole/java/bundle-messages.sh | 4 ++- .../i2p/router/web/ConfigLoggingHelper.java | 29 ++++++--------- .../net/i2p/router/web/ConfigNetHelper.java | 2 +- .../src/net/i2p/router/web/NetDbRenderer.java | 36 +++++++++++++------ .../i2p/router/web/SummaryBarRenderer.java | 2 +- build.xml | 1 + history.txt | 4 +++ .../src/net/i2p/router/RouterVersion.java | 2 +- 8 files changed, 47 insertions(+), 33 deletions(-) diff --git a/apps/routerconsole/java/bundle-messages.sh b/apps/routerconsole/java/bundle-messages.sh index e035efabd..1e634cedf 100755 --- a/apps/routerconsole/java/bundle-messages.sh +++ b/apps/routerconsole/java/bundle-messages.sh @@ -16,7 +16,9 @@ do # make list of java files newer than the .po file find src ../jsp/WEB-INF strings -name *.java -newer $i > $TMPFILE - if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a ! -s $TMPFILE ] + if [ -s build/obj/net/i2p/router/web/messages_$LG.class -a \ + build/obj/net/i2p/router/web/messages_$LG.class -nt $i -a \ + ! -s $TMPFILE ] then continue fi diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHelper.java index e1e7907b0..c64c9af76 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigLoggingHelper.java @@ -48,30 +48,21 @@ public class ConfigLoggingHelper extends HelperBase { buf.append("Valid levels are DEBUG, INFO, WARN, ERROR, CRIT\n"); return buf.toString(); } + + private static String[] levels = { _x("CRIT"), _x("ERROR"), _x("WARN"), _x("INFO"), _x("DEBUG") }; + public String getDefaultLogLevelBox() { String cur = _context.logManager().getDefaultLimit(); StringBuilder buf = new StringBuilder(128); buf.append("\n"); return buf.toString(); diff --git a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java index 2a188881f..b7a692daa 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/ConfigNetHelper.java @@ -162,7 +162,7 @@ public class ConfigNetHelper extends HelperBase { return kbytesToBits(getShareBandwidth()); } private String kbytesToBits(int kbytes) { - return DataHelper.formatSize(kbytes * 8 * 1024) + " bits per second"; + return DataHelper.formatSize(kbytes * 8 * 1024) + ' ' + _("bits per second"); } public String getInboundBurstRate() { return "" + _context.bandwidthLimiter().getInboundBurstKBytesPerSecond(); diff --git a/apps/routerconsole/java/src/net/i2p/router/web/NetDbRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/NetDbRenderer.java index 194a98088..abd20b770 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/NetDbRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/NetDbRenderer.java @@ -71,7 +71,7 @@ public class NetDbRenderer { } } if (notFound) - buf.append(_("Router") + " ").append(routerPrefix).append(" " + _("not found in network database") ); + buf.append(_("Router") + ' ').append(routerPrefix).append(' ' + _("not found in network database") ); } out.write(buf.toString()); out.flush(); @@ -93,19 +93,19 @@ public class NetDbRenderer { LeaseSet ls = (LeaseSet)iter.next(); Destination dest = ls.getDestination(); Hash key = dest.calculateHash(); - buf.append("LeaseSet: ").append(key.toBase64()); + buf.append("").append(_("LeaseSet")).append(": ").append(key.toBase64()); if (_context.clientManager().isLocal(dest)) { buf.append(" (" + _("Local") + " "); if (! _context.clientManager().shouldPublishLeaseSet(key)) - buf.append(_("Unpublished") + " "); - buf.append(_("Destination") + " "); + buf.append(_("Unpublished") + ' '); + buf.append(_("Destination") + ' '); TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(key); if (in != null && in.getDestinationNickname() != null) buf.append(in.getDestinationNickname()); else buf.append(dest.toBase64().substring(0, 6)); } else { - buf.append(" (" + _("Destination") + " "); + buf.append(" (" + _("Destination") + ' '); String host = _context.namingService().reverseLookup(dest); if (host != null) buf.append(host); @@ -115,13 +115,13 @@ public class NetDbRenderer { buf.append(")
\n"); long exp = ls.getEarliestLeaseDate()-now; if (exp > 0) - buf.append("Expires in ").append(DataHelper.formatDuration(exp)).append("
\n"); + buf.append(_("Expires in {0}", DataHelper.formatDuration(exp))).append("
\n"); else - buf.append("Expired ").append(DataHelper.formatDuration(0-exp)).append(" ago
\n"); + buf.append(_("Expired {0} ago", DataHelper.formatDuration(0-exp))).append("
\n"); for (int i = 0; i < ls.getLeaseCount(); i++) { - buf.append("Lease ").append(i + 1).append(": " + _("Gateway") + " "); + buf.append(_("Lease")).append(' ').append(i + 1).append(": " + _("Gateway") + ' '); buf.append(_context.commSystem().renderPeerHTML(ls.getLease(i).getGateway())); - buf.append(" " + _("Tunnel") + " ").append(ls.getLease(i).getTunnelId().getTunnelId()).append("
\n"); + buf.append(' ' + _("Tunnel") + ' ').append(ls.getLease(i).getTunnelId().getTunnelId()).append("
\n"); } buf.append("
\n"); out.write(buf.toString()); @@ -225,7 +225,7 @@ public class NetDbRenderer { if (full) { buf.append("[Back]\n"); } else { - buf.append("[Full entry]\n"); + buf.append("[").append(_("Full entry")).append("]\n"); } } @@ -269,4 +269,20 @@ public class NetDbRenderer { private String _(String s) { return Messages.getString(s, _context); } + + /** + * translate a string with a parameter + * This is a lot more expensive than _(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")) + * Do not double the single quotes in the parameter. + * Use autoboxing to call with ints, longs, floats, etc. + */ + private String _(String s, Object o) { + return Messages.getString(s, o, _context); + } } diff --git a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java index b05e4e338..71b61cb71 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/SummaryBarRenderer.java @@ -37,7 +37,7 @@ public class SummaryBarRenderer { buf.append(linkhelper.getContent()); } else { buf.append("

") .append(_("I2P Services")) .append("

\n" + diff --git a/build.xml b/build.xml index 3c75faed8..9d7f55c1b 100644 --- a/build.xml +++ b/build.xml @@ -8,6 +8,7 @@ --> + diff --git a/history.txt b/history.txt index 690a90c69..97719fc4a 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,7 @@ +2009-10-29 zzz + * Console tag fixes, bundle script fix + * Add help target to build.xml + 2009-10-28 zzz * Console: - Rewrite TrustedUpdate version comparator, use for netdb version table diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 0116da736..f47a425fd 100644 --- a/router/java/src/net/i2p/router/RouterVersion.java +++ b/router/java/src/net/i2p/router/RouterVersion.java @@ -18,7 +18,7 @@ public class RouterVersion { /** deprecated */ public final static String ID = "Monotone"; public final static String VERSION = CoreVersion.VERSION; - public final static long BUILD = 8; + public final static long BUILD = 9; /** for example "-test" */ public final static String EXTRA = ""; public final static String FULL_VERSION = VERSION + "-" + BUILD + EXTRA;