From bf70a1520b839b9eb3b2431a2d048e30c8b270aa Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 4 Dec 2019 17:16:14 +0000 Subject: [PATCH] Console: Sort internals section after translation --- .../web/helpers/SummaryBarRenderer.java | 116 +++++++++++------- 1 file changed, 74 insertions(+), 42 deletions(-) diff --git a/apps/routerconsole/java/src/net/i2p/router/web/helpers/SummaryBarRenderer.java b/apps/routerconsole/java/src/net/i2p/router/web/helpers/SummaryBarRenderer.java index 4fd0666cd..9c96f1758 100644 --- a/apps/routerconsole/java/src/net/i2p/router/web/helpers/SummaryBarRenderer.java +++ b/apps/routerconsole/java/src/net/i2p/router/web/helpers/SummaryBarRenderer.java @@ -308,67 +308,99 @@ class SummaryBarRenderer { "
\n"); + // Store all items in map so they are sorted by translated name, add the plugins, then output + Map svcs = new TreeMap(Collator.getInstance()); + StringBuilder rbuf = new StringBuilder(128); PortMapper pm = _context.portMapper(); if (pm.isRegistered(PortMapper.SVC_SUSIDNS)) { - buf.append("") - .append(nbsp(_t("Addressbook"))) - .append("\n"); + String tx = _t("Addressbook"); + rbuf.append("") + .append(nbsp(tx)) + .append("\n"); + svcs.put(tx, rbuf.toString()); } if (!StatSummarizer.isDisabled(_context)) { - buf.append("") - .append(nbsp(_t("Graphs"))) - .append("\n"); + String tx = _t("Graphs"); + rbuf.setLength(0); + rbuf.append("") + .append(nbsp(tx)) + .append("\n"); + svcs.put(tx, rbuf.toString()); } - buf.append("") - .append(nbsp(_t("Help"))) + .append(nbsp(tx)) .append("\n"); + svcs.put(tx, rbuf.toString()); if (pm.isRegistered(PortMapper.SVC_I2PTUNNEL)) { - buf.append("") - .append(nbsp(_t("Hidden Services Manager"))) - .append("\n"); + tx = _t("Hidden Services Manager"); + rbuf.setLength(0); + rbuf.append("") + .append(nbsp(tx)) + .append("\n"); + svcs.put(tx, rbuf.toString()); } - buf.append("") - .append(nbsp(_t("Logs"))) - .append("\n" + + tx = _t("Logs"); + rbuf.setLength(0); + rbuf.append("") + .append(nbsp(tx)) + .append("\n"); + svcs.put(tx, rbuf.toString()); - "") - .append(nbsp(_t("NetDB"))) - .append("\n" + + tx = _t("NetDB"); + rbuf.setLength(0); + rbuf.append("") + .append(nbsp(tx)) + .append("\n"); + svcs.put(tx, rbuf.toString()); - "") - .append(nbsp(_t("Peers"))) - .append("\n" + + tx = _t("Peers"); + rbuf.setLength(0); + rbuf.append("") + .append(nbsp(tx)) + .append("\n"); + svcs.put(tx, rbuf.toString()); - "") - .append(nbsp(_t("Profiles"))) - .append("\n" + + tx = _t("Profiles"); + rbuf.setLength(0); + rbuf.append("") + .append(nbsp(tx)) + .append("\n"); + svcs.put(tx, rbuf.toString()); - "") - .append(nbsp(_t("Tunnels"))) - .append("\n"); + tx = _t("Tunnels"); + rbuf.setLength(0); + rbuf.append("") + .append(nbsp(tx)) + .append("\n"); + svcs.put(tx, rbuf.toString()); + for (String row : svcs.values()) { + buf.append(row); + } buf.append("
\n"); return buf.toString(); }