Make WordPress Core

#41643 closed defect (bug) (fixed)

i18n: Use %s placeholders in rest api translation strings

Reported by: ramiy Owned by: SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch
Focuses: rest-api Cc:

Attachments (2)

force-true.png (69.9 KB) - added by ramiy 11 months ago.
41643.patch (4.2 KB) - added by ramiy 11 months ago.

Download all attachments as: .zip

Change History (9)

11 months ago

11 months ago

#1 @ramiy
11 months ago

  • Keywords has-patch added

#2 @ramiy
11 months ago

The translators should not have access to code like force=true, they can accidentally change some characters.

When using code in translation strings we should always use %s placeholders.

#3 @SergeyBiryukov
11 months ago

  • Component changed from Text Changes to I18N
  • Focuses rest-api added
  • Milestone changed from Awaiting Review to 4.9
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

#4 @johnbillion
11 months ago

This is good, but I think the translator comment can be improved to better explain what force=true is.

#5 @ramiy
11 months ago

@johnbillion This is the common practice. We usually use the file name, function name or code example in the translator comments. But if you have a better explanation, I'll update the patch.

#6 @johnbillion
11 months ago

In that case, fine by me.

#7 @SergeyBiryukov
10 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 41588:

I18N: Replace code fragments in translatable strings for rest_trash_not_supported errors with a placeholder.

Props ramiy.
Fixes #41643.

Note: See TracTickets for help on using tickets.