[wp-trac] [WordPress Trac] #46683: Site Health: audit the translation functions

WordPress Trac noreply at wordpress.org
Mon Apr 8 11:21:56 UTC 2019


#46683: Site Health: audit the translation functions
-------------------------------------+-------------------------------
 Reporter:  afercia                  |       Owner:  SergeyBiryukov
     Type:  defect (bug)             |      Status:  accepted
 Priority:  normal                   |   Milestone:  5.2
Component:  Administration           |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  needs-patch site-health  |     Focuses:  coding-standards
-------------------------------------+-------------------------------

Comment (by ocean90):

 Replying to [comment:8 SergeyBiryukov]:
 > The main issue from the ticket description with strings like this is
 also still relevant:
 >
 > * `<span class="issue-count">0</span> <?php _e( 'Critical issues' ); ?>`

 To fix this you can use `_n()` and `sprintf()` from the `wp.i18n` package
 like so:

 {{{#!js
 var _n = wp.i18n._n;
 var sprintf = wp.i18n.sprintf;
 var headline = sprintf( _n( '%s Critical Issues', '%s Critical Issues',
 count ), '<span class="issue-count">' + count + '</span>' );
 }}}

 The result should replace the inner HTML of the `h3` element.

 Any string that's added via `SiteHealth.string` should probably be
 switched to using `wp.i18n`.

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


More information about the wp-trac mailing list