[wp-trac] [WordPress Trac] #37057: Creation of an esc_html functions for _n(), _nx(), _ex(), and number_format_i18n()
WordPress Trac
noreply at wordpress.org
Fri Mar 25 18:43:48 UTC 2022
#37057: Creation of an esc_html functions for _n(), _nx(), _ex(), and
number_format_i18n()
-------------------------+------------------------------
Reporter: zakkath | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: I18N | Version:
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
-------------------------+------------------------------
Comment (by malthert):
+1 from me.
{{{#!php
<?php
// random to give a simple example
$count = rand( 1, 10 );
$color = rand( 1, 100 ) % 2 === 0 ? 'green' : 'blue';
printf( esc_html_n( '%s elephant', '%s elephants', $count, 'textdomain' ),
esc_html( $color ) );
// or also for cases like:
printf( _n( '%d years, %d month', '%d years, %d months', $diff->m,
'customnew' ), esc_html( $diff->y ), esc_html( $diff->m ) )
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37057#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list