From 6c0e18d3e2f125a5c01c454607e5c7a3364d6cef Mon Sep 17 00:00:00 2001 From: zzz Date: Sun, 7 Jun 2020 20:00:50 +0000 Subject: [PATCH] i2ptunnel: Fix missing tunnel quantity section for servers More ngettext Hide some text for config advanced --- apps/i2ptunnel/java/bundle-messages.sh | 2 +- .../src/net/i2p/i2ptunnel/ui/Messages.java | 7 ++ .../src/net/i2p/i2ptunnel/web/EditBean.java | 15 ++- apps/i2ptunnel/jsp/editClient.jsi | 41 ++++---- apps/i2ptunnel/jsp/editServer.jsi | 99 +++++++++---------- history.txt | 7 +- .../src/net/i2p/router/RouterVersion.java | 2 +- 7 files changed, 97 insertions(+), 76 deletions(-) diff --git a/apps/i2ptunnel/java/bundle-messages.sh b/apps/i2ptunnel/java/bundle-messages.sh index 5840f620e9..e12d790493 100755 --- a/apps/i2ptunnel/java/bundle-messages.sh +++ b/apps/i2ptunnel/java/bundle-messages.sh @@ -70,7 +70,7 @@ do # then ant distclean updater. find $JPATHS -name *.java > $TMPFILE xgettext -f $TMPFILE -F -L java --from-code=UTF-8 --add-comments\ - --keyword=_t --keyword=_x --keyword=intl._ --keyword=intl.title \ + --keyword=_t --keyword=_x --keyword=intl._ --keyword=intl.title --keyword=unlessAdvanced \ -o ${i}t if [ $? -ne 0 ] then diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/Messages.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/Messages.java index 0737bfc53e..cbb6ba6e2e 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/Messages.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/Messages.java @@ -54,4 +54,11 @@ public class Messages { public static String ngettext(String s, String p, int n, I2PAppContext ctx) { return Translate.getString(n, s, p, ctx, BUNDLE_NAME); } + + /** translate (ngettext) + * @since 0.9.47 + */ + public String ngettext(String s, String p, int n) { + return Translate.getString(n, s, p, _context, BUNDLE_NAME); + } } diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java index 9673bd1331..db934cc375 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/web/EditBean.java @@ -530,7 +530,8 @@ public class EditBean extends IndexBean { public String getQuantityOptions(int tunnel, int mode) { int tunnelQuantity = mode == 2 ? getTunnelQuantityOut(tunnel, DFLT_QUANTITY) : getTunnelQuantity(tunnel, DFLT_QUANTITY); - int maxQuantity = isAdvanced() ? MAX_ADVANCED_QUANTITY : + boolean adv = isAdvanced(); + int maxQuantity = adv ? MAX_ADVANCED_QUANTITY : (isClient(tunnel) ? MAX_CLIENT_QUANTITY : MAX_SERVER_QUANTITY); if (tunnelQuantity > maxQuantity) maxQuantity = tunnelQuantity; @@ -546,7 +547,7 @@ public class EditBean extends IndexBean { buf.append(ngettext("{0} outbound tunnel", "{0} outbound tunnels", i)); else buf.append(ngettext("{0} inbound, {0} outbound tunnel", "{0} inbound, {0} outbound tunnels", i)); - if (i <= 3) { + if (i <= 3 && !adv) { buf.append(" ("); if (i == 1) buf.append(_t("lower bandwidth and reliability")); @@ -560,4 +561,14 @@ public class EditBean extends IndexBean { } return buf.toString(); } + + /** + * @return translated s or "" + * @since 0.9.47 + */ + public String unlessAdvanced(String s) { + if (isAdvanced()) + return ""; + return " (" + _t(s) + ')'; + } } diff --git a/apps/i2ptunnel/jsp/editClient.jsi b/apps/i2ptunnel/jsp/editClient.jsi index e0bafbdb49..698d232364 100644 --- a/apps/i2ptunnel/jsp/editClient.jsi +++ b/apps/i2ptunnel/jsp/editClient.jsi @@ -300,29 +300,28 @@ " class="selectbox"> <% int tunnelBackupQuantity = editBean.getTunnelBackupQuantity(curTunnel, 0); - %> - - - + %> + + + <% if (tunnelBackupQuantity > 3) { - %> + %> <% } %> diff --git a/apps/i2ptunnel/jsp/editServer.jsi b/apps/i2ptunnel/jsp/editServer.jsi index ee5771105d..188f9c82f8 100644 --- a/apps/i2ptunnel/jsp/editServer.jsi +++ b/apps/i2ptunnel/jsp/editServer.jsi @@ -292,27 +292,27 @@ " class="selectbox"> <% int tunnelDepthOut = editBean.getTunnelDepthOut(curTunnel, 3); - %> - - - - - - - + %> + + + + + + + +<% + } // isAdvanced() End outbound config section +%> @@ -366,9 +369,12 @@ - + <% + } // isAdvanced() +%> - + <% if (editBean.isAdvanced()) { + // repeat two options above for outbound + %> @@ -421,13 +421,12 @@ diff --git a/history.txt b/history.txt index d9b42b1d4f..c6c1e71dd5 100644 --- a/history.txt +++ b/history.txt @@ -1,6 +1,11 @@ +2020-06-07 zzz + * i2ptunnel: Fix missing tunnel quantity section for servers + * Jetty: Update servlet-api + 2020-06-06 zzz - * Data: Fix creation of Encrypted LS2 + * Data: Fix creation of Encrypted LS2 (ticket #2746) * I2CP: Fix issues with persisted leaseset private keys + * I2CP, i2ptunnel: Check for expired offline signature client-side 2020-06-03 zzz * i2psnark: Enable dual-keys diff --git a/router/java/src/net/i2p/router/RouterVersion.java b/router/java/src/net/i2p/router/RouterVersion.java index 4e28a2c8d2..c10128fe62 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 = 5; + public final static long BUILD = 6; /** for example "-test" */ public final static String EXTRA = "";
+<% if (editBean.isAdvanced()) { + %> <%=intl._t("Inbound")%> -
<%=intl._t("Count")%> @@ -383,27 +389,21 @@
<%=intl._t("Outbound")%>