fix pagination translations and pluralization

If a message does not contain '\n', pluralize is not called. Also
replace {{ hidden_replies }} with {{ n }}.
This commit is contained in:
Martin Zimmermann 2014-05-27 22:03:20 +02:00
parent cff9cabe9a
commit 96206b110c
5 changed files with 13 additions and 11 deletions

View File

@ -55,7 +55,9 @@ define(["app/config", "app/i18n/de", "app/i18n/en", "app/i18n/fr", "app/i18n/ru"
var msg; var msg;
msg = translate(msgid); msg = translate(msgid);
if (msg.indexOf("\n") > -1) {
msg = plural(msg.split("\n"), (+ n)); msg = plural(msg.split("\n"), (+ n));
}
return msg ? msg.replace("{{ n }}", (+ n)) : msg; return msg ? msg.replace("{{ n }}", (+ n)) : msg;
}; };

View File

@ -15,7 +15,7 @@ define({
"comment-deleted": "Kommentar gelöscht.", "comment-deleted": "Kommentar gelöscht.",
"comment-queued": "Kommentar muss noch freigeschaltet werden.", "comment-queued": "Kommentar muss noch freigeschaltet werden.",
"comment-anonymous": "Anonym", "comment-anonymous": "Anonym",
"comment-hidden": "{{ hidden_replies }} versteckt", "comment-hidden": "{{ n }} versteckt",
"date-now": "eben jetzt", "date-now": "eben jetzt",
"date-minute": "vor einer Minute\nvor {{ n }} Minuten", "date-minute": "vor einer Minute\nvor {{ n }} Minuten",
"date-hour": "vor einer Stunde\nvor {{ n }} Stunden", "date-hour": "vor einer Stunde\nvor {{ n }} Stunden",

View File

@ -18,7 +18,7 @@ define({
"comment-deleted": "Comment deleted.", "comment-deleted": "Comment deleted.",
"comment-queued": "Comment in queue for moderation.", "comment-queued": "Comment in queue for moderation.",
"comment-anonymous": "Anonymous", "comment-anonymous": "Anonymous",
"comment-hidden": "{{ hidden_replies }} Hidden", "comment-hidden": "{{ n }} Hidden",
"date-now": "right now", "date-now": "right now",
"date-minute": "a minute ago\n{{ n }} minutes ago", "date-minute": "a minute ago\n{{ n }} minutes ago",

View File

@ -15,7 +15,7 @@ define({
"comment-deleted": "Commentaire supprimé.", "comment-deleted": "Commentaire supprimé.",
"comment-queued": "Commentaire en attente de modération.", "comment-queued": "Commentaire en attente de modération.",
"comment-anonymous": "Anonyme", "comment-anonymous": "Anonyme",
"comment-hidden": "1 caché\n{{ hidden_replies }} cachés", "comment-hidden": "1 caché\n{{ n }} cachés",
"date-now": "À l'instant'", "date-now": "À l'instant'",
"date-minute": "Il y a une minute \n{{ n }} minutes", "date-minute": "Il y a une minute \n{{ n }} minutes",
"date-hour": "Il y a une heure\n{{ n }} heures ", "date-hour": "Il y a une heure\n{{ n }} heures ",

View File

@ -54,16 +54,16 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
return el; return el;
}; };
var insert_loader = function(commentWrapper, lastcreated) { var insert_loader = function(comment, lastcreated) {
var entrypoint; var entrypoint;
if (commentWrapper.id === null) { if (comment.id === null) {
entrypoint = $("#isso-root"); entrypoint = $("#isso-root");
commentWrapper.name = 'null'; comment.name = 'null';
} else { } else {
entrypoint = $("#isso-" + commentWrapper.id + " > .text-wrapper > .isso-follow-up"); entrypoint = $("#isso-" + comment.id + " > .text-wrapper > .isso-follow-up");
commentWrapper.name = commentWrapper.id; comment.name = comment.id;
} }
var el = $.htmlify(jade.render("comment_loader", {"comment": commentWrapper})); var el = $.htmlify(jade.render("comment-loader", {"comment": comment}));
entrypoint.append(el); entrypoint.append(el);
@ -72,7 +72,7 @@ define(["app/dom", "app/utils", "app/config", "app/api", "app/jade", "app/i18n",
el.remove(); el.remove();
api.fetch($("#isso-thread").getAttribute("data-isso-id"), api.fetch($("#isso-thread").getAttribute("data-isso-id"),
config["reveal-on-click"], config["max-comments-nested"], config["reveal-on-click"], config["max-comments-nested"],
commentWrapper.id, comment.id,
lastcreated).then( lastcreated).then(
function(rv) { function(rv) {
if (rv.total_replies === 0) { if (rv.total_replies === 0) {