Skip to content

Commit

Permalink
comments_async/comment_box: fix comment count plural not updating pro…
Browse files Browse the repository at this point in the history
…perly
  • Loading branch information
goapunk authored and philli-m committed Jan 24, 2024
1 parent 2195f69 commit aa44c6c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 8 additions & 2 deletions adhocracy4/comments_async/static/comments_async/comment_box.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ export const CommentBox = (props) => {
function handleComments (result) {
const data = result

translated.entries = django.ngettext('entry', 'entries', data.count)
setComments(data.results)
setNextComments(data.next)
setCommentCount(data.comment_count)
Expand Down Expand Up @@ -409,6 +408,13 @@ export const CommentBox = (props) => {
}
}

function translatedEntries (entries) {
return django.ngettext(
'entry',
'entries', entries
)
}

function translatedEntriesFound (entriesFound) {
return django.ngettext(
'entry found for ',
Expand Down Expand Up @@ -472,7 +478,7 @@ export const CommentBox = (props) => {
<div
className={search === '' ? 'a4-comments__filters__text' : 'd-none'}
>
{commentCount + ' ' + translated.entries}
{commentCount + ' ' + translatedEntries(commentCount)}
</div>

<div
Expand Down
3 changes: 3 additions & 0 deletions changelog/_4444.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Fixed

- fix comment count plurals not updating properly

0 comments on commit aa44c6c

Please sign in to comment.