[wp-meta] [Making WordPress.org] #6256: Disable translation warning discard for unexpected additional printf placeholders.

Making WordPress.org noreply at wordpress.org
Wed Apr 6 07:25:21 UTC 2022

#6256: Disable translation warning discard for unexpected additional printf
 Reporter:  dd32                      |      Owner:  (none)
     Type:  defect (bug)              |     Status:  new
 Priority:  high                      |  Milestone:
Component:  Translate Site & Plugins  |   Keywords:  needs-patch
 It's not too uncommon for translators to discard printf-related warnings,
 when they believe the warning is in error. Sometimes it is in error, but
 if it's not..

 Unfortunately when a translator inserts extra placeholders into such a
 string accidentally, for example, using `%` within the string and not
 encoding it as `%%` it causes one of two things to happen:
  - PHP 7: String is never displayed.
  - PHP 8: Fatal error is encountered. Page will not render.

 In both cases, having ''fewer'' placeholders in the string is okay, just
 not more.

 Perhaps sometimes this is indeed an error in the warnings, and we should
 fix that, but, as plugin/theme translations go out automatically to sites
 we need to ensure that we never cause them to fatal due to a faulty

 For example:
  Original: `This is 100 percent bug free! <a href="%s">See this for
  Problematic translation: `Yo! We so great! 100% bug free! <a
 href="%s">Check it!</a>`
  Working translation: `Yo! We so great! 100%% bug free! <a href="%s">Check

 It's also common with URLs in translations with non-ascii characters, as
 `%20` or similar in a URL needs to be encoded as `%%20`.

 Here's an example of an error that I've encountered on WordPress.org today
 while testing PHP 8.1 readiness:
 E_ERROR: Uncaught ArgumentCountError: 34 arguments are required, 2 given
 (34 utf8 characters in an included URL encoded as %12%34%56, etc)

 In reality, currently it means that in the locale in question, the `This
 post was held for moderation by our automated system but has taken longer
 than expected to get approved. Please come to the #forums channel on <a
 href="%s">WordPress Sl....` message on their forums has never displayed
 correctly (or at least, not for the last year or so).

 This search on Slack will bring up other cases of this: `in:#polyglots-
 warnings Extra placeholder in translation.`

Ticket URL: <https://meta.trac.wordpress.org/ticket/6256>
Making WordPress.org <https://meta.trac.wordpress.org/>
Making WordPress.org

More information about the wp-meta mailing list