[buddypress-trac] [BuddyPress Trac] #8821: Preventing ArgumentCountError when using sprintf/printf functions

buddypress-trac noreply at wordpress.org
Wed Feb 15 09:22:19 UTC 2023


#8821: Preventing ArgumentCountError when using sprintf/printf functions
------------------------------------+----------------------
 Reporter:  imath                   |       Owner:  slaFFik
     Type:  defect (bug)            |      Status:  closed
 Priority:  normal                  |   Milestone:  11.1.0
Component:  I18N                    |     Version:
 Severity:  normal                  |  Resolution:  fixed
 Keywords:  dev-feedback has-patch  |
------------------------------------+----------------------
Changes (by imath):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"13420" 13420]:
 {{{
 #!CommitTicketReference repository="" revision="13420"
 Edit translator comments of problematic strings

 In 11.0 we have removed 1 placeholder to 2 strings used to display the
 activity action for published posts. Issues were raised about the fact
 some polyglots teams did not update corresponding translations leaving the
 removed placeholder in their translated strings. As these two strings are
 used inside `sprintf()` function it resulted in fatal errors for the
 corresponding locales.

 We hope simply improving the comment will avoid such mistakes raising
 translators attention. The result of this commit should avoid the string
 to be translated as long as the polyglots team haven't updated their
 translations.

 It is a temporary fix, the right one should be to create a "sanitization"
 function wrapping `sprintf()` to make sure expected placeholders are found
 into the translated strings.

 Although we think this kind of function should be made available by
 WordPress, in [https://core.trac.wordpress.org/ticket/55776#comment:3 this
 ticket] the issue was diagnosed as invalid. It's probably ok when you have
 a lot of polyglots contributors like WordPress has, **it's a different
 situation for plugins**: we will work on preventing these potential fatals
 in the next major release (12.0).

 Props 1benk1, webmasterfreya

 Fixes #8821 (branch 11.0)
 }}}

-- 
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/8821#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list