console: ngettext fixes

This commit is contained in:
zzz
2020-08-29 13:32:34 +00:00
parent ba7fb00450
commit 623a11dd8f
4 changed files with 13 additions and 14 deletions

View File

@ -246,7 +246,7 @@ public class PluginStarter implements Runnable {
updated++; updated++;
} }
if (updated > 0) if (updated > 0)
mgr.notifyComplete(null, ngettext("1 plugin updated", "{0} plugins updated", updated, ctx)); mgr.notifyComplete(null, ngettext("{0} plugin updated", "{0} plugins updated", updated, ctx));
else else
mgr.notifyComplete(null, Messages.getString("Plugin update check complete", ctx)); mgr.notifyComplete(null, Messages.getString("Plugin update check complete", ctx));
} }

View File

@ -13,8 +13,8 @@ public class ConfigTunnelsHelper extends HelperBase {
private static final String HOP = "hop"; private static final String HOP = "hop";
private static final String TUNNEL = "tunnel"; private static final String TUNNEL = "tunnel";
/** dummies for translation */ /** dummies for translation */
private static final String HOPS = ngettext("1 hop", "{0} hops"); private static final String HOPS = ngettext("{0} hop", "{0} hops");
private static final String TUNNELS = ngettext("1 tunnel", "{0} tunnels"); private static final String TUNNELS = ngettext("{0} tunnel", "{0} tunnels");
public String getForm() { public String getForm() {
StringBuilder buf = new StringBuilder(1024); StringBuilder buf = new StringBuilder(1024);
@ -219,7 +219,6 @@ public class ConfigTunnelsHelper extends HelperBase {
} }
/** to fool xgettext so the following isn't tagged */ /** to fool xgettext so the following isn't tagged */
private static final String DUMMY1 = "1 ";
private static final String DUMMY2 = "{0} "; private static final String DUMMY2 = "{0} ";
private void renderOptions(StringBuilder buf, int min, int max, int now, String prefix, String name) { private void renderOptions(StringBuilder buf, int min, int max, int now, String prefix, String name) {
@ -227,7 +226,7 @@ public class ConfigTunnelsHelper extends HelperBase {
buf.append("<option value=\"").append(i).append("\" "); buf.append("<option value=\"").append(i).append("\" ");
if (i == now) if (i == now)
buf.append(SELECTED); buf.append(SELECTED);
buf.append(">").append(ngettext(DUMMY1 + name, DUMMY2 + name + 's', i)); buf.append(">").append(ngettext(DUMMY2 + name, DUMMY2 + name + 's', i));
buf.append("</option>\n"); buf.append("</option>\n");
} }
} }

View File

@ -83,11 +83,11 @@ class ProfileOrganizerRenderer {
//buf.append("<h2>").append(_t("Peer Profiles")).append("</h2>\n<p>"); //buf.append("<h2>").append(_t("Peer Profiles")).append("</h2>\n<p>");
buf.append("<p id=\"profiles_overview\" class=\"infohelp\">"); buf.append("<p id=\"profiles_overview\" class=\"infohelp\">");
buf.append(ngettext("Showing 1 recent profile.", "Showing {0} recent profiles.", order.size())).append('\n'); buf.append(ngettext("Showing {0} recent profile.", "Showing {0} recent profiles.", order.size())).append('\n');
if (older > 0) if (older > 0)
buf.append(ngettext("Hiding 1 older profile.", "Hiding {0} older profiles.", older)).append('\n'); buf.append(ngettext("Hiding {0} older profile.", "Hiding {0} older profiles.", older)).append('\n');
if (standard > 0) if (standard > 0)
buf.append("<a href=\"/profiles?f=1\">").append(ngettext("Hiding 1 standard profile.", "Hiding {0} standard profiles.", standard)).append("</a>\n"); buf.append("<a href=\"/profiles?f=1\">").append(ngettext("Hiding {0} standard profile.", "Hiding {0} standard profiles.", standard)).append("</a>\n");
buf.append("</p>"); buf.append("</p>");
buf.append("<div class=\"widescroll\"><table id=\"profilelist\">"); buf.append("<div class=\"widescroll\"><table id=\"profilelist\">");
buf.append("<tr>"); buf.append("<tr>");
@ -288,11 +288,11 @@ class ProfileOrganizerRenderer {
.append("</th><th><b>") .append("</th><th><b>")
.append(_t("Integration")).append(": </b>").append(num(_organizer.getIntegrationThreshold())) .append(_t("Integration")).append(": </b>").append(num(_organizer.getIntegrationThreshold()))
.append("</th></tr><tr><td>") .append("</th></tr><tr><td>")
.append(fast).append(' ').append(_t("fast peers")) .append(ngettext("{0} fast peer", "{0} fast peers", fast))
.append("</td><td>") .append("</td><td>")
.append(reliable).append(' ').append(_t("high capacity peers")) .append(ngettext("{0} high capacity peer", "{0} high capacity peers", reliable))
.append("</td><td>") .append("</td><td>")
.append(integrated).append(' ').append(_t(" well integrated peers")) .append(ngettext("{0} integrated peer", "{0} integrated peers", integrated))
.append("</td></tr></tbody></table>\n"); .append("</td></tr></tbody></table>\n");
buf.append("<h3 class=\"tabletitle\">").append(_t("Definitions")).append("</h3>\n") buf.append("<h3 class=\"tabletitle\">").append(_t("Definitions")).append("</h3>\n")
.append("<table id=\"profile_defs\"><tbody>"); .append("<table id=\"profile_defs\"><tbody>");

View File

@ -173,7 +173,7 @@ public class StatsGenerator {
buf.append("<li><b>").append(_t("Lifetime average frequency")).append(":</b> "); buf.append("<li><b>").append(_t("Lifetime average frequency")).append(":</b> ");
buf.append(DataHelper.formatDuration2(freq.getFrequency())); buf.append(DataHelper.formatDuration2(freq.getFrequency()));
buf.append(" ("); buf.append(" (");
buf.append(ngettext("1 event", "{0} events", (int) freq.getEventCount())); buf.append(ngettext("{0} event", "{0} events", (int) freq.getEventCount()));
buf.append(")</li></ul><br>\n"); buf.append(")</li></ul><br>\n");
} }
@ -231,7 +231,7 @@ public class StatsGenerator {
} }
buf.append("<span class=\"nowrap\">"); buf.append("<span class=\"nowrap\">");
buf.append(ngettext("There was 1 event in this period.", "There were {0} events in this period.", (int)curRate.getLastEventCount())); buf.append(ngettext("There was {0} event in this period.", "There were {0} events in this period.", (int)curRate.getLastEventCount()));
buf.append("</span> <span class=\"nowrap\">"); buf.append("</span> <span class=\"nowrap\">");
buf.append(_t("The period ended {0} ago.", DataHelper.formatDuration2(now - curRate.getLastCoalesceDate()))); buf.append(_t("The period ended {0} ago.", DataHelper.formatDuration2(now - curRate.getLastCoalesceDate())));
buf.append("</span>"); buf.append("</span>");
@ -266,7 +266,7 @@ public class StatsGenerator {
buf.append("<li><b>").append(_t("Lifetime average value")).append(":</b> "); buf.append("<li><b>").append(_t("Lifetime average value")).append(":</b> ");
buf.append(num(rate.getLifetimeAverageValue())); buf.append(num(rate.getLifetimeAverageValue()));
buf.append(" ("); buf.append(" (");
buf.append(ngettext("1 event", "{0} events", (int) rate.getLifetimeEventCount())); buf.append(ngettext("{0} event", "{0} events", (int) rate.getLifetimeEventCount()));
buf.append(")<br></li>" + buf.append(")<br></li>" +
"</ul>" + "</ul>" +
"<br>\n"); "<br>\n");