Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

comments_async/comment_box: fix comment count plural not updating pro… #1519

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading