Add pluralization to list member locale

This commit is contained in:
Andreas Nedbal 2022-07-27 23:13:36 +02:00 committed by Andreas Nedbal
parent c2726687e4
commit 5f1453103b
4 changed files with 12 additions and 3 deletions

View File

@ -23,7 +23,7 @@ export function listMembershipHandler(event: Event): void {
success: (data) => { success: (data) => {
if (data.success) { if (data.success) {
checkbox.checked = data.checked; checkbox.checked = data.checked;
memberCountElement.innerHTML = memberCountElement.dataset.i18n.replace('%{count}', memberCount.toString()); memberCountElement.innerHTML = I18n.t('frontend.list.item.members', { count: memberCount });
memberCountElement.dataset.count = memberCount.toString(); memberCountElement.dataset.count = memberCount.toString();
} }

View File

@ -10,7 +10,7 @@
.media-body .media-body
.list-group-item-heading= list.display_name .list-group-item-heading= list.display_name
.list-group-item-text.text-muted .list-group-item-text.text-muted
%span{ id: "#{list.name}-members", data: { count: list.members.count, i18n: t(".members") } }= t(".members", count: list.members.count) %span{ id: "#{list.name}-members", data: { count: list.members.count } }= t(".members", count: list.members.count)
· ·
%a.text-danger#delete-list{ href: "#", data: { list: list.name } } %a.text-danger#delete-list{ href: "#", data: { list: list.name } }
%i.fa.fa-close %i.fa.fa-close

View File

@ -45,3 +45,9 @@ en:
title: "Really report this %{type}?" title: "Really report this %{type}?"
text: "A moderator will review your report and decide what happens.\nIf you'd like, you can also specify a reason." text: "A moderator will review your report and decide what happens.\nIf you'd like, you can also specify a reason."
input: "Specify a reason..." input: "Specify a reason..."
list:
item:
members:
zero: "0 members"
one: "1 member"
other: "%{count} members"

View File

@ -169,7 +169,10 @@ en:
action: "Create list" action: "Create list"
placeholder: "List name" placeholder: "List name"
item: item:
members: "%{count} members" members:
zero: "0 members"
one: "1 member"
other: "%{count} members"
privileges: privileges:
title: "Manage roles for %{user}" title: "Manage roles for %{user}"
role: role: