Changeset 39039b8


Ignore:
Timestamp:
Mar 10, 2018 5:19:38 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
eb321445
Parents:
e7c2162
Message:

Console: Fix translated (es) plural
Warnings for special cases on /configtunnels

Location:
apps/routerconsole/java/src/net/i2p/router/web/helpers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/ConfigTunnelsHelper.java

    re7c2162 r39039b8  
    77import net.i2p.data.Destination;
    88import net.i2p.router.TunnelPoolSettings;
     9import net.i2p.router.transport.TransportUtil;
    910import net.i2p.router.web.HelperBase;
    1011
     
    7879            in.getLength() + in.getLengthVariance() <= 0 ||
    7980            out.getLength() <= 0 ||
    80             out.getLength() + out.getLengthVariance() <= 0)
     81            out.getLength() + out.getLengthVariance() <= 0) {
    8182            buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _t("ANONYMITY WARNING - Settings include 0-hop tunnels.") + "</font></th></tr>");
    82         else if (in.getLength() <= 1 ||
     83            if (TransportUtil.getIPv6Config(_context, "SSU") == TransportUtil.IPv6Config.IPV6_ONLY) {
     84                // rare, don't bother translating
     85                buf.append("<tr><th colspan=\"3\"><font color=\"red\">WARNING - 0-hop tunnels not recommended for IPv6-only routers.</font></th></tr>");
     86            }
     87            if ((in.getLength() <= 0 || in.getLength() + in.getLengthVariance() <= 0) &&
     88                _context.router().isHidden()) {
     89                // rare, don't bother translating
     90                buf.append("<tr><th colspan=\"3\"><font color=\"red\">WARNING - Inbound 0-hop tunnels not recommended for hidden routers.</font></th></tr>");
     91            }
     92        } else if (in.getLength() <= 1 ||
    8393            in.getLength() + in.getLengthVariance() <= 1 ||
    8494            out.getLength() <= 1 ||
    85             out.getLength() + out.getLengthVariance() <= 1)
     95            out.getLength() + out.getLengthVariance() <= 1) {
    8696            buf.append("<tr><th colspan=\"3\"><font color=\"red\">" + _t("ANONYMITY WARNING - Settings include 1-hop tunnels.") + "</font></th></tr>");
     97        }
    8798        if (in.getLength() + Math.abs(in.getLengthVariance()) >= WARN_LENGTH ||
    8899            out.getLength() + Math.abs(out.getLengthVariance()) >= WARN_LENGTH)
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/NetDbRenderer.java

    re7c2162 r39039b8  
    1616import java.text.DecimalFormat;      // debug
    1717import java.util.ArrayList;
     18import java.util.Collection;
    1819import java.util.Collections;
    1920import java.util.Comparator;
     
    648649           .append(info.getIdentity().getSigningPublicKey().getType().toString());
    649650        buf.append("</td></tr>\n<tr>")
    650            .append("<td><b>" + _t("Address(es)") + ":</b></td>")
     651           .append("<td><b>" + _t("Addresses") + ":</b></td>")
    651652           .append("<td colspan=\"2\" class=\"netdb_addresses\">");
    652         for (RouterAddress addr : info.getAddresses()) {
    653             String style = addr.getTransportStyle();
    654             buf.append("<br><b class=\"netdb_transport\">").append(DataHelper.stripHTML(style)).append(":</b>");
    655             int cost = addr.getCost();
    656             if (!((style.equals("SSU") && cost == 5) || (style.equals("NTCP") && cost == 10)))
    657                 buf.append("&nbsp;<span class=\"netdb_name\">").append(_t("cost")).append("</span>: <span class=\"netdb_info\">").append("" + cost).append("</span>&nbsp;");
    658             Map<Object, Object> p = addr.getOptionsMap();
    659             for (Map.Entry<Object, Object> e : p.entrySet()) {
    660                 String name = (String) e.getKey();
    661                 String val = (String) e.getValue();
    662                 buf.append(" <span class=\"nowrap\"><span class=\"netdb_name\">").append(_t(DataHelper.stripHTML(name)))
    663                    .append(":</span> <span class=\"netdb_info\">").append(DataHelper.stripHTML(val)).append("</span></span>&nbsp;");
     653        Collection<RouterAddress> addrs = info.getAddresses();
     654        if (addrs.isEmpty()) {
     655            buf.append(_t("none"));
     656        } else {
     657            for (RouterAddress addr : info.getAddresses()) {
     658                String style = addr.getTransportStyle();
     659                buf.append("<br><b class=\"netdb_transport\">").append(DataHelper.stripHTML(style)).append(":</b>");
     660                int cost = addr.getCost();
     661                if (!((style.equals("SSU") && cost == 5) || (style.equals("NTCP") && cost == 10)))
     662                    buf.append("&nbsp;<span class=\"netdb_name\">").append(_t("cost")).append("</span>: <span class=\"netdb_info\">").append("" + cost).append("</span>&nbsp;");
     663                Map<Object, Object> p = addr.getOptionsMap();
     664                for (Map.Entry<Object, Object> e : p.entrySet()) {
     665                    String name = (String) e.getKey();
     666                    String val = (String) e.getValue();
     667                    buf.append(" <span class=\"nowrap\"><span class=\"netdb_name\">").append(_t(DataHelper.stripHTML(name)))
     668                       .append(":</span> <span class=\"netdb_info\">").append(DataHelper.stripHTML(val)).append("</span></span>&nbsp;");
     669                }
    664670            }
    665671        }
Note: See TracChangeset for help on using the changeset viewer.