Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#38383 closed defect (bug) (fixed)

Twenty Seventeen: Incorrect use of `_x()` in `twentyseventeen_posted_on()`

Reported by: ocean90's profile ocean90 Owned by: karmatosed's profile karmatosed
Milestone: 4.7 Priority: normal
Severity: normal Version:
Component: Bundled Theme Keywords: good-first-bug needs-testing has-patch
Focuses: Cc:

Description

https://github.com/WordPress/twentyseventeen/blob/5b5e4e86c2b8343863d7633758987da93c2bf2e8/inc/template-tags.php#L20

_x() is used to differ two similar strings with different meanings. Translators comments are used to describe placeholders.

Same for twentyseventeen_time_link(), see https://github.com/WordPress/twentyseventeen/blob/a15f8d1ed4003007b8e25330dc787cda7b7a32f7/inc/template-tags.php#L48.

Attachments (4)

ticket.38383.diff (1.2 KB) - added by dineshc 8 years ago.
ticket.38383.2.diff (1.2 KB) - added by dineshc 8 years ago.
38383-3.diff (1.1 KB) - added by mbelchev 8 years ago.
38383.4.patch (1.2 KB) - added by davidakennedy 8 years ago.
Adds translator comments.

Download all attachments as: .zip

Change History (13)

#1 @ocean90
8 years ago

  • Keywords good-first-bug added

@dineshc
8 years ago

#2 @dineshc
8 years ago

I have attached diff file. Please check the solution for this ticket.

#3 @davidakennedy
8 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

#4 @ocean90
8 years ago

  • Keywords needs-patch added; has-patch needs-testing removed

Thanks for your patch, @dineshc.

The "by %s" string needs a translators comment which explains the placeholder.

The other string should be improved so that the span tag is available for translators: __( '<span class="screen-reader-text">Posted on </span>%s', 'twentyseventeen' )

#5 @mbelchev
8 years ago

I've added the span tag so it is available for translators and also use sprintf.

@mbelchev
8 years ago

#6 @mbelchev
8 years ago

  • Keywords needs-testing added; needs-patch removed

#7 @davidakennedy
8 years ago

  • Keywords has-patch added

@davidakennedy
8 years ago

Adds translator comments.

#8 @davidakennedy
8 years ago

38383.4.patch builds on the work of @dineshc and @mbelchev and adds the needed translator comments.

#9 @karmatosed
8 years ago

  • Owner set to karmatosed
  • Resolution set to fixed
  • Status changed from new to closed

In 38885:

Twenty Seventeen: Fixes incorrect use of _x()

There is an incorrect use in twentyseventeen_posted_on(). This fixes that.

Props ocean90, dineshc, mbelchev, davidakennedy
Fixes #38383

Note: See TracTickets for help on using tickets.