WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 3 days ago

#49058 accepted defect (bug)

Twenty Twenty: Comments report

Reported by: Parvand Owned by: audrasjb
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.3.2
Component: Bundled Theme Keywords: good-first-bug has-patch has-screenshots commit
Focuses: template, coding-standards Cc:

Description

problem in comments.php
at line 35 where it starts:

} elseif ( '1' === $comments_number ) {

its not work for translate. I think it should be as follows:

} elseif ( '1' == $comments_number ) {

i change and it work now.

in twentynineteen its :

if ( '1' == $discussion->responses ) {

is that problem or not?

Attachments (9)

49058.diff (623 bytes) - added by benjamingosset 5 weeks ago.
Apply patch
before-patch.png (41.8 KB) - added by benjamingosset 5 weeks ago.
Before patch
after-patch.png (43.5 KB) - added by benjamingosset 5 weeks ago.
After patch
1-comment-2015.png (30.3 KB) - added by audrasjb 3 days ago.
Twenty Fifteen: translation correctly applied.
1-comment-2016.png (26.3 KB) - added by audrasjb 3 days ago.
Twenty Sixteen: translation correctly applied.
1-comment-2017.png (21.1 KB) - added by audrasjb 3 days ago.
Twenty Seventeen: translation correctly applied.
1-comment-2019.png (28.8 KB) - added by audrasjb 3 days ago.
Twenty Nineteen: translation correctly applied.
1-comment-2020.png (41.8 KB) - added by audrasjb 3 days ago.
Twenty Twenty: translation will never be applied.
49058.1.diff (508 bytes) - added by opurockey 111 minutes ago.
Apply patch

Download all attachments as: .zip

Change History (19)

#1 follow-up: @SergeyBiryukov
5 months ago

  • Keywords reporter-feedback added; needs-design-feedback removed

Hi there, welcome to WordPress Trac! Thanks for the report.

That condition is correct as is, since get_comments_number() returns a numeric string, not an integer. It's also the same in other bundled themes (except for Twenty Nineteen). See #38369 for more details.

Could you clarify what exactly is the problem with translations?

Last edited 5 months ago by SergeyBiryukov (previous) (diff)

#2 @desrosj
5 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed

@Parvand I am going to close this out because the lines you mentioned are correct from a code standpoint.

If you are still experiencing issues, please reopen the ticket and add more details about the problem with translations so it can be troubleshooted further.

#3 @juliobox
5 weeks ago

  • Keywords needs-patch added
  • Resolution worksforme deleted
  • Status changed from closed to reopened

Hey there
The issue is still there, but here is the real bug :

Line 26 : $comments_number = absint( get_comments_number() );
Line 36 : } elseif ( '1' === $comments_number ) {

This is why this if can't be triggered.
The patch is : } elseif ( 1 === $comments_number ) {

Have a good day

#4 @Mista-Flo
5 weeks ago

  • Keywords good-first-bug added

Good catch, I agree with Julio.

@benjamingosset
5 weeks ago

Apply patch

@benjamingosset
5 weeks ago

Before patch

@benjamingosset
5 weeks ago

After patch

#5 @benjamingosset
5 weeks ago

Hey,

This is my first contribution, i applied the patch proposed by Julio.
I added screenshots before/after applying patch, it seems ok.

Could someone check if everything is ok ?

Thanks

#6 @SergeyBiryukov
4 weeks ago

  • Keywords has-patch added; reporter-feedback needs-patch removed
  • Milestone set to 5.5

#7 in reply to: ↑ 1 @elimuhub
8 days ago

Replying to SergeyBiryukov:

Hi there, welcome to WordPress Trac! Thanks for the report.

That condition is correct as is, since get_comments_number() returns a numeric string, not an integer. It's also the same in other bundled themes (except for Twenty Nineteen). See #38369 for more details.

Could you clarify what exactly is the problem with translations?

#8 @SergeyBiryukov
4 days ago

#50221 was marked as a duplicate.

@audrasjb
3 days ago

Twenty Fifteen: translation correctly applied.

@audrasjb
3 days ago

Twenty Sixteen: translation correctly applied.

@audrasjb
3 days ago

Twenty Seventeen: translation correctly applied.

@audrasjb
3 days ago

Twenty Nineteen: translation correctly applied.

@audrasjb
3 days ago

Twenty Twenty: translation will never be applied.

#9 @audrasjb
3 days ago

  • Keywords has-screenshots commit added
  • Owner set to audrasjb
  • Status changed from reopened to accepted

@SergeyBiryukov I think the previous commenters are right, Twenty Twenty will never apply this translation.
The current patch fixes the issue on my side.

Marking this ticket for commit.

#10 @audrasjb
3 days ago

PS: I tested all the other themes and they are all displaying the correct translation.

@opurockey
111 minutes ago

Apply patch

Note: See TracTickets for help on using tickets.