ngettext cleanups

This commit is contained in:
zzz
2011-03-12 18:00:58 +00:00
parent e47afffd09
commit b23f278c3f
2 changed files with 12 additions and 7 deletions

View File

@ -70,11 +70,11 @@ class ProfileOrganizerRenderer {
int failing = 0;
StringBuilder buf = new StringBuilder(16*1024);
buf.append("<h2>").append(_("Peer Profiles")).append("</h2>\n<p>");
buf.append(_("Showing {0} recent profiles.", order.size())).append('\n');
buf.append(_(order.size(), "Showing 1 recent profile.", "Showing {0} recent profiles.")).append('\n');
if (older > 0)
buf.append(_("Hiding {0} older profiles.", older)).append('\n');
buf.append(_(older, "Hiding 1 older profile.", "Hiding {0} older profiles.")).append('\n');
if (standard > 0)
buf.append("<a href=\"/profiles?f=1\">").append(_("Hiding {0} standard profiles.", standard)).append("</a>\n");
buf.append("<a href=\"/profiles?f=1\">").append(_(standard, "Hiding 1 standard profile.", "Hiding {0} standard profiles.")).append("</a>\n");
buf.append("</p>");
buf.append("<table>");
buf.append("<tr>");
@ -359,4 +359,10 @@ class ProfileOrganizerRenderer {
private String _(String s, Object o) {
return Messages.getString(s, o, _context);
}
/** translate (ngettext) @since 0.8.5 */
public String _(int n, String s, String p) {
return Messages.getString(n, s, p, _context);
}
}

View File

@ -198,10 +198,9 @@ public class StatsGenerator {
buf.append("; ");
}
// breaking the sentence like before makes translation in my language impossible.
buf.append(_("There were {0} event(s) in this period", curRate.getLastEventCount()));
// buf.append(' ');
buf.append(_(" which ended {0} ago.", DataHelper.formatDuration2(now - curRate.getLastCoalesceDate())));
buf.append(ngettext((int)curRate.getLastEventCount(), "There was 1 event in this period.", "There were {0} events in this period."));
buf.append(' ');
buf.append(_("The period ended {0} ago.", DataHelper.formatDuration2(now - curRate.getLastCoalesceDate())));
} else {
buf.append(" <i>").append(_("No events")).append("</i> ");
}