fix: i18n placement caused incorrect reaction authors rendering

I've made a fix to better handle rendering of reaction authors in conjuction with i18n
This commit is contained in:
hydrogen 2020-12-02 08:24:36 +02:00 committed by Iuri Matias
parent cfb17cd85c
commit 4e1f712376
1 changed files with 6 additions and 6 deletions

View File

@ -9,13 +9,13 @@ Item {
height: 20
width: childrenRect.width
function lastTwoItems(left, right) {
return qsTr("%1 and %2").arg(left, right);
function lastTwoItems(nodes) {
return nodes.join(qsTr(" and "));
}
function showReactionAuthors(fromAccounts) {
if (fromAccounts.length < 3)
return fromAccounts.join(qsTr(" and "));
return lastTwoItems(fromAccounts);
var leftNode = [];
var rightNode = [];
@ -24,13 +24,13 @@ Item {
leftNode = fromAccounts.slice(0, 3);
rightNode = fromAccounts.slice(3, fromAccounts.length);
return (rightNode.length == 1) ?
lastTwoItems(leftNode.join(", "), rightNode[0]) :
lastTwoItems(leftNode.join(", "), qsTr("%1 more reacted.").arg(rightNode.length));
lastTwoItems([leftNode.join(", "), rightNode[0]]) :
lastTwoItems([leftNode.join(", "), qsTr("%1 more reacted.").arg(rightNode.length)]);
}
leftNode = fromAccounts.slice(0, 2);
rightNode = fromAccounts.slice(2, fromAccounts.length);
return lastTwoItems(leftNode.join(", "), rightNode[0]);
return lastTwoItems([leftNode.join(", "), rightNode[0]]);
}
Repeater {