Summary Bar: Change header from "I2P Updates" to "Update Status" (ticket #2137)

/configsidebar: Tag sections for translation; translate unselected sections;
sort unselected sections by translated name
This commit is contained in:
zzz
2018-05-26 13:56:06 +00:00
parent 39c0f558c1
commit f11104e7bc
4 changed files with 42 additions and 31 deletions

View File

@ -38,27 +38,27 @@ class SummaryBarRenderer {
static { static {
Map<String, String> aMap = new HashMap<String, String>();; Map<String, String> aMap = new HashMap<String, String>();;
aMap.put("HelpAndFAQ", "Help &amp; FAQ"); aMap.put("HelpAndFAQ", _x("Help &amp; FAQ"));
aMap.put("I2PServices", "I2P Services"); aMap.put("I2PServices", _x("I2P Services"));
aMap.put("I2PInternals", "I2P Internals"); aMap.put("I2PInternals", _x("I2P Internals"));
aMap.put("RouterInfo", "Router Information"); aMap.put("RouterInfo", _x("Router Information"));
aMap.put("ShortRouterInfo", "Short Router Information"); aMap.put("ShortRouterInfo", _x("Router Information (brief)"));
aMap.put("AdvancedRouterInfo", "Router Information (advanced)"); aMap.put("AdvancedRouterInfo", _x("Router Information (advanced)"));
aMap.put("MemoryBar", "Memory Usage Bar"); aMap.put("MemoryBar", _x("Memory Usage Bar"));
aMap.put("NetworkReachability", "Network Reachability"); aMap.put("NetworkReachability", _x("Network Reachability"));
aMap.put("UpdateStatus", "Update Status"); aMap.put("UpdateStatus", _x("Update Status"));
aMap.put("RestartStatus", "Restart Status"); aMap.put("RestartStatus", _x("Restart Status"));
aMap.put("Peers", "Peers"); aMap.put("Peers", _x("Peers"));
aMap.put("PeersAdvanced", "Peers (advanced)"); aMap.put("PeersAdvanced", _x("Peers (advanced)"));
aMap.put("FirewallAndReseedStatus", "Firewall &amp; Reseed Status"); aMap.put("FirewallAndReseedStatus", _x("Firewall &amp; Reseed Status"));
aMap.put("Bandwidth", "Bandwidth"); aMap.put("Bandwidth", _x("Bandwidth"));
aMap.put("BandwidthGraph", "Bandwidth Graph (experimental)"); aMap.put("BandwidthGraph", _x("Bandwidth Graph"));
aMap.put("Tunnels", "Tunnels"); aMap.put("Tunnels", _x("Tunnels"));
aMap.put("Congestion", "Congestion"); aMap.put("Congestion", _x("Congestion"));
aMap.put("TunnelStatus", "Tunnel Status"); aMap.put("TunnelStatus", _x("Tunnel Status"));
aMap.put("Destinations", "Local Tunnels"); aMap.put("Destinations", _x("Local Tunnels"));
aMap.put("NewsHeadings", "News &amp; Updates"); aMap.put("NewsHeadings", _x("News &amp; Updates"));
aMap.put("Advanced", "Advanced Console Links"); aMap.put("Advanced", _x("Advanced Links"));
SECTION_NAMES = Collections.unmodifiableMap(aMap); SECTION_NAMES = Collections.unmodifiableMap(aMap);
} }
@ -606,7 +606,7 @@ class SummaryBarRenderer {
buf.append("<h3><a href=\"/configupdate\" target=\"_top\" title=\"") buf.append("<h3><a href=\"/configupdate\" target=\"_top\" title=\"")
.append(_t("Configure I2P Updates")) .append(_t("Configure I2P Updates"))
.append("\">") .append("\">")
.append(_t("I2P Update")) .append(_t("Update Status"))
.append("</a></h3><hr class=\"b\">\n"); .append("</a></h3><hr class=\"b\">\n");
buf.append(updateStatus); buf.append(updateStatus);
return buf.toString(); return buf.toString();
@ -1014,6 +1014,11 @@ class SummaryBarRenderer {
return buf.toString(); return buf.toString();
} }
/** tag only */
private static final String _x(String s) {
return s;
}
/** translate a string */ /** translate a string */
private String _t(String s) { private String _t(String s) {
return Messages.getString(s, _context); return Messages.getString(s, _context);

View File

@ -9,7 +9,7 @@ import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeSet; import java.util.TreeMap;
import net.i2p.data.DataHelper; import net.i2p.data.DataHelper;
import net.i2p.data.Destination; import net.i2p.data.Destination;
@ -1052,7 +1052,8 @@ public class SummaryHelper extends HelperBase {
String[] allSections = SummaryBarRenderer.ALL_SECTIONS; String[] allSections = SummaryBarRenderer.ALL_SECTIONS;
Map<String, String> sectionNames = SummaryBarRenderer.SECTION_NAMES; Map<String, String> sectionNames = SummaryBarRenderer.SECTION_NAMES;
List<String> sections = getSummaryBarSections("default"); List<String> sections = getSummaryBarSections("default");
TreeSet<String> sortedSections = new TreeSet<String>(); // translated section name to section id
TreeMap<String, String> sortedSections = new TreeMap<String, String>(Collator.getInstance());
// Forward-convert old section names // Forward-convert old section names
int pos = sections.indexOf("General"); int pos = sections.indexOf("General");
@ -1066,8 +1067,11 @@ public class SummaryHelper extends HelperBase {
for (int i = 0; i < allSections.length; i++) { for (int i = 0; i < allSections.length; i++) {
String section = allSections[i]; String section = allSections[i];
if (!sections.contains(section)) if (!sections.contains(section)) {
sortedSections.add(section); String name = sectionNames.get(section);
if (name != null)
sortedSections.put(_t(name), section);
}
} }
String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME); String theme = _context.getProperty(CSSHelper.PROP_THEME_NAME, CSSHelper.DEFAULT_THEME);
@ -1155,10 +1159,9 @@ public class SummaryHelper extends HelperBase {
.append(_t("Select a section to add")) .append(_t("Select a section to add"))
.append("</option>\n"); .append("</option>\n");
for (String s : sortedSections) { for (Map.Entry<String, String> e : sortedSections.entrySet()) {
String name = sectionNames.get(s); String name = e.getKey();
if (name == null) String s = e.getValue();
continue;
buf.append("<option value=\"").append(s).append("\">") buf.append("<option value=\"").append(s).append("\">")
.append(name).append("</option>\n"); .append(name).append("</option>\n");
} }

View File

@ -1,6 +1,9 @@
2018-05-26 zzz 2018-05-26 zzz
* /configsidebar: Tag sections for translation; sort unselected sections by translated name
* Router: Fix wrapper.config path in OOM message when installed as * Router: Fix wrapper.config path in OOM message when installed as
Debian package, but not running as a service (ticket #2223) Debian package, but not running as a service (ticket #2223)
* Summary Bar: Change header from "I2P Updates" to "Update Status" (ticket #2137)
* Utils: Disable DNSoverHTTPS by default (ticket #2201)
2018-05-25 zzz 2018-05-25 zzz
* Console: Fix changes to wrong tunnel on /configtunnels (ticket #2227) * Console: Fix changes to wrong tunnel on /configtunnels (ticket #2227)

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */ /** deprecated */
public final static String ID = "Monotone"; public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION; public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 11; public final static long BUILD = 12;
/** for example "-test" */ /** for example "-test" */
public final static String EXTRA = ""; public final static String EXTRA = "";