Changeset f11104e for apps


Ignore:
Timestamp:
May 26, 2018 1:56:06 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
5ca319e
Parents:
39c0f55
Message:

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

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/SummaryBarRenderer.java

    r39c0f55 rf11104e  
    3939    static {
    4040        Map<String, String> aMap = new HashMap<String, String>();;
    41         aMap.put("HelpAndFAQ", "Help &amp; FAQ");
    42         aMap.put("I2PServices", "I2P Services");
    43         aMap.put("I2PInternals", "I2P Internals");
    44         aMap.put("RouterInfo", "Router Information");
    45         aMap.put("ShortRouterInfo", "Short Router Information");
    46         aMap.put("AdvancedRouterInfo", "Router Information (advanced)");
    47         aMap.put("MemoryBar", "Memory Usage Bar");
    48         aMap.put("NetworkReachability", "Network Reachability");
    49         aMap.put("UpdateStatus", "Update Status");
    50         aMap.put("RestartStatus", "Restart Status");
    51         aMap.put("Peers", "Peers");
    52         aMap.put("PeersAdvanced", "Peers (advanced)");
    53         aMap.put("FirewallAndReseedStatus", "Firewall &amp; Reseed Status");
    54         aMap.put("Bandwidth", "Bandwidth");
    55         aMap.put("BandwidthGraph", "Bandwidth Graph (experimental)");
    56         aMap.put("Tunnels", "Tunnels");
    57         aMap.put("Congestion", "Congestion");
    58         aMap.put("TunnelStatus", "Tunnel Status");
    59         aMap.put("Destinations", "Local Tunnels");
    60         aMap.put("NewsHeadings", "News &amp; Updates");
    61         aMap.put("Advanced", "Advanced Console Links");
     41        aMap.put("HelpAndFAQ", _x("Help &amp; FAQ"));
     42        aMap.put("I2PServices", _x("I2P Services"));
     43        aMap.put("I2PInternals", _x("I2P Internals"));
     44        aMap.put("RouterInfo", _x("Router Information"));
     45        aMap.put("ShortRouterInfo", _x("Router Information (brief)"));
     46        aMap.put("AdvancedRouterInfo", _x("Router Information (advanced)"));
     47        aMap.put("MemoryBar", _x("Memory Usage Bar"));
     48        aMap.put("NetworkReachability", _x("Network Reachability"));
     49        aMap.put("UpdateStatus", _x("Update Status"));
     50        aMap.put("RestartStatus", _x("Restart Status"));
     51        aMap.put("Peers", _x("Peers"));
     52        aMap.put("PeersAdvanced", _x("Peers (advanced)"));
     53        aMap.put("FirewallAndReseedStatus", _x("Firewall &amp; Reseed Status"));
     54        aMap.put("Bandwidth", _x("Bandwidth"));
     55        aMap.put("BandwidthGraph", _x("Bandwidth Graph"));
     56        aMap.put("Tunnels", _x("Tunnels"));
     57        aMap.put("Congestion", _x("Congestion"));
     58        aMap.put("TunnelStatus", _x("Tunnel Status"));
     59        aMap.put("Destinations", _x("Local Tunnels"));
     60        aMap.put("NewsHeadings", _x("News &amp; Updates"));
     61        aMap.put("Advanced", _x("Advanced Links"));
    6262        SECTION_NAMES = Collections.unmodifiableMap(aMap);
    6363    }
     
    607607           .append(_t("Configure I2P Updates"))
    608608           .append("\">")
    609            .append(_t("I2P Update"))
     609           .append(_t("Update Status"))
    610610           .append("</a></h3><hr class=\"b\">\n");
    611611        buf.append(updateStatus);
     
    10151015    }
    10161016
     1017    /** tag only */
     1018    private static final String _x(String s) {
     1019        return s;
     1020    }
     1021
    10171022    /** translate a string */
    10181023    private String _t(String s) {
  • apps/routerconsole/java/src/net/i2p/router/web/helpers/SummaryHelper.java

    r39c0f55 rf11104e  
    1010import java.util.List;
    1111import java.util.Map;
    12 import java.util.TreeSet;
     12import java.util.TreeMap;
    1313
    1414import net.i2p.data.DataHelper;
     
    10531053        Map<String, String> sectionNames = SummaryBarRenderer.SECTION_NAMES;
    10541054        List<String> sections = getSummaryBarSections("default");
    1055         TreeSet<String> sortedSections = new TreeSet<String>();
     1055        // translated section name to section id
     1056        TreeMap<String, String> sortedSections = new TreeMap<String, String>(Collator.getInstance());
    10561057
    10571058        // Forward-convert old section names
     
    10671068        for (int i = 0; i < allSections.length; i++) {
    10681069            String section = allSections[i];
    1069             if (!sections.contains(section))
    1070                 sortedSections.add(section);
     1070            if (!sections.contains(section)) {
     1071                String name = sectionNames.get(section);
     1072                if (name != null)
     1073                    sortedSections.put(_t(name), section);
     1074            }
    10711075        }
    10721076
     
    11561160           .append("</option>\n");
    11571161
    1158         for (String s : sortedSections) {
    1159             String name = sectionNames.get(s);
    1160             if (name == null)
    1161                 continue;
     1162        for (Map.Entry<String, String> e : sortedSections.entrySet()) {
     1163            String name = e.getKey();
     1164            String s = e.getValue();
    11621165            buf.append("<option value=\"").append(s).append("\">")
    11631166               .append(name).append("</option>\n");
Note: See TracChangeset for help on using the changeset viewer.