Making WordPress.org

Opened 7 years ago

Closed 7 years ago

#2979 closed defect (bug) (fixed)

fix for multiple placeholders should be ordered

Reported by: afzalmultani's profile afzalmultani Owned by: coffee2code's profile coffee2code
Milestone: Priority: normal
Component: Developer Hub Keywords: has-patch
Cc:

Description

Multiple placeholders should be ordered. Expected '%1$s, %2$d', but got %s, %d.

Attachments (3)

2979.diff (1.2 KB) - added by afzalmultani 7 years ago.
fix for multiple placeholders should be ordered
2979.2.diff (1.2 KB) - added by afzalmultani 7 years ago.
UPdated
2979.3.diff (1.4 KB) - added by SergeyBiryukov 7 years ago.

Download all attachments as: .zip

Change History (7)

@afzalmultani
7 years ago

fix for multiple placeholders should be ordered

@afzalmultani
7 years ago

UPdated

#1 @SergeyBiryukov
7 years ago

  • Component changed from General to Developer Hub

#2 follow-up: @SergeyBiryukov
7 years ago

  • Keywords has-patch added

Hi @afzalmultani, thanks for the patch.

'Used by <a href="%s">1 function</a>' and 'Used by <a href="%s">%d functions</a>' are separate strings, the placeholders are not really interchangeable here and don't necessarily have to be numbered.

2979.2.diff appears to treat them as a single string, making the result invalid:

  • 'Used by <a href="%1$s"> function</a>' is missing the %2$d placeholder with the number of functions.
  • 'Used by <a href="%2$d"> functions</a>' is missing the %1$s placeholder with the permalink.

That said, this block needs a few other adjustments:

Addressed in 2979.3.diff.

Last edited 7 years ago by SergeyBiryukov (previous) (diff)

#3 in reply to: ↑ 2 @afzalmultani
7 years ago

Hi @SergeyBiryukov,

Thanks for the patch and explanation. Definitely, it will help me a lot.

#4 @coffee2code
7 years ago

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

In 5721:

developer.wordpress.org: Improve translatability of "Used By"/ "Uses" string.

  • Use placeholder instead of hardcoding 1 in string.
  • Use numbered placeholders, with comments for translators.
  • Update link anchor targets to #used-by/#uses, respectively.

Props SergeyBiryukov.
Fixes #2979.

Note: See TracTickets for help on using tickets.