[wp-trac] [WordPress Trac] #44340: Make use of sprintf function while translating strings

WordPress Trac noreply at wordpress.org
Fri Aug 17 14:43:56 UTC 2018


#44340: Make use of sprintf function while translating strings
-----------------------------+-------------------------------
 Reporter:  saimonh          |       Owner:  (none)
     Type:  defect (bug)     |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Users            |     Version:  4.9.6
 Severity:  normal           |  Resolution:
 Keywords:  has-patch close  |     Focuses:  coding-standards
-----------------------------+-------------------------------
Changes (by GaryJ):

 * keywords:  has-patch => has-patch close


Comment:

 Hi @saimonh,

 Congrats on creating your first ticket :-)

 In this case, I'd say that the change is unnecessary.

 It's fine for strings to have basic HTML in them. In some cases, it's
 necessary, so that the translator can choose what word has the strong
 emphasis, or which words are the link text, etc.

 In this case, you've split the strings up into multiple strings, which
 doesn't help with understanding context - they might be a different word
 for "ERROR", depending on what the issue is, but after your patch, that
 wouldn't be easy to adjust for, without also adding context (`_x()`) which
 then results in the same string having to be translated mutliple times.

 Also, you've left the colon (`:`) in the sprintf template, meaning other
 punctuation can't be used if other locales use something different to a
 colon.

 If markup is only at the ends of a string, then that's more likely to be a
 good candidate for pulling the markup out.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44340#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list