forked from I2P_Developers/i2p.i2p
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:
@ -38,27 +38,27 @@ class SummaryBarRenderer {
|
||||
|
||||
static {
|
||||
Map<String, String> aMap = new HashMap<String, String>();;
|
||||
aMap.put("HelpAndFAQ", "Help & FAQ");
|
||||
aMap.put("I2PServices", "I2P Services");
|
||||
aMap.put("I2PInternals", "I2P Internals");
|
||||
aMap.put("RouterInfo", "Router Information");
|
||||
aMap.put("ShortRouterInfo", "Short Router Information");
|
||||
aMap.put("AdvancedRouterInfo", "Router Information (advanced)");
|
||||
aMap.put("MemoryBar", "Memory Usage Bar");
|
||||
aMap.put("NetworkReachability", "Network Reachability");
|
||||
aMap.put("UpdateStatus", "Update Status");
|
||||
aMap.put("RestartStatus", "Restart Status");
|
||||
aMap.put("Peers", "Peers");
|
||||
aMap.put("PeersAdvanced", "Peers (advanced)");
|
||||
aMap.put("FirewallAndReseedStatus", "Firewall & Reseed Status");
|
||||
aMap.put("Bandwidth", "Bandwidth");
|
||||
aMap.put("BandwidthGraph", "Bandwidth Graph (experimental)");
|
||||
aMap.put("Tunnels", "Tunnels");
|
||||
aMap.put("Congestion", "Congestion");
|
||||
aMap.put("TunnelStatus", "Tunnel Status");
|
||||
aMap.put("Destinations", "Local Tunnels");
|
||||
aMap.put("NewsHeadings", "News & Updates");
|
||||
aMap.put("Advanced", "Advanced Console Links");
|
||||
aMap.put("HelpAndFAQ", _x("Help & FAQ"));
|
||||
aMap.put("I2PServices", _x("I2P Services"));
|
||||
aMap.put("I2PInternals", _x("I2P Internals"));
|
||||
aMap.put("RouterInfo", _x("Router Information"));
|
||||
aMap.put("ShortRouterInfo", _x("Router Information (brief)"));
|
||||
aMap.put("AdvancedRouterInfo", _x("Router Information (advanced)"));
|
||||
aMap.put("MemoryBar", _x("Memory Usage Bar"));
|
||||
aMap.put("NetworkReachability", _x("Network Reachability"));
|
||||
aMap.put("UpdateStatus", _x("Update Status"));
|
||||
aMap.put("RestartStatus", _x("Restart Status"));
|
||||
aMap.put("Peers", _x("Peers"));
|
||||
aMap.put("PeersAdvanced", _x("Peers (advanced)"));
|
||||
aMap.put("FirewallAndReseedStatus", _x("Firewall & Reseed Status"));
|
||||
aMap.put("Bandwidth", _x("Bandwidth"));
|
||||
aMap.put("BandwidthGraph", _x("Bandwidth Graph"));
|
||||
aMap.put("Tunnels", _x("Tunnels"));
|
||||
aMap.put("Congestion", _x("Congestion"));
|
||||
aMap.put("TunnelStatus", _x("Tunnel Status"));
|
||||
aMap.put("Destinations", _x("Local Tunnels"));
|
||||
aMap.put("NewsHeadings", _x("News & Updates"));
|
||||
aMap.put("Advanced", _x("Advanced Links"));
|
||||
SECTION_NAMES = Collections.unmodifiableMap(aMap);
|
||||
}
|
||||
|
||||
@ -606,7 +606,7 @@ class SummaryBarRenderer {
|
||||
buf.append("<h3><a href=\"/configupdate\" target=\"_top\" title=\"")
|
||||
.append(_t("Configure I2P Updates"))
|
||||
.append("\">")
|
||||
.append(_t("I2P Update"))
|
||||
.append(_t("Update Status"))
|
||||
.append("</a></h3><hr class=\"b\">\n");
|
||||
buf.append(updateStatus);
|
||||
return buf.toString();
|
||||
@ -1014,6 +1014,11 @@ class SummaryBarRenderer {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/** tag only */
|
||||
private static final String _x(String s) {
|
||||
return s;
|
||||
}
|
||||
|
||||
/** translate a string */
|
||||
private String _t(String s) {
|
||||
return Messages.getString(s, _context);
|
||||
|
@ -9,7 +9,7 @@ import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.data.Destination;
|
||||
@ -1052,7 +1052,8 @@ public class SummaryHelper extends HelperBase {
|
||||
String[] allSections = SummaryBarRenderer.ALL_SECTIONS;
|
||||
Map<String, String> sectionNames = SummaryBarRenderer.SECTION_NAMES;
|
||||
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
|
||||
int pos = sections.indexOf("General");
|
||||
@ -1066,8 +1067,11 @@ public class SummaryHelper extends HelperBase {
|
||||
|
||||
for (int i = 0; i < allSections.length; i++) {
|
||||
String section = allSections[i];
|
||||
if (!sections.contains(section))
|
||||
sortedSections.add(section);
|
||||
if (!sections.contains(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);
|
||||
@ -1155,10 +1159,9 @@ public class SummaryHelper extends HelperBase {
|
||||
.append(_t("Select a section to add"))
|
||||
.append("</option>\n");
|
||||
|
||||
for (String s : sortedSections) {
|
||||
String name = sectionNames.get(s);
|
||||
if (name == null)
|
||||
continue;
|
||||
for (Map.Entry<String, String> e : sortedSections.entrySet()) {
|
||||
String name = e.getKey();
|
||||
String s = e.getValue();
|
||||
buf.append("<option value=\"").append(s).append("\">")
|
||||
.append(name).append("</option>\n");
|
||||
}
|
||||
|
Reference in New Issue
Block a user