Make WordPress Core

Ticket #37191: 37191.diff

File 37191.diff, 1.9 KB (added by henry.wright, 8 years ago)
  • src/wp-includes/l10n.php

    diff --git src/wp-includes/l10n.php src/wp-includes/l10n.php
    index c637774..38b0261 100644
    function _n( $single, $plural, $number, $domain = 'default' ) { 
    348348}
    349349
    350350/**
     351 * Translates and retrieves the singular or plural form based on the supplied number
     352 * and escapes it for safe use in HTML output.
     353 *
     354 * @since 4.7.0
     355 *
     356 * @param string $single The text to be used if the number is singular.
     357 * @param string $plural The text to be used if the number is plural.
     358 * @param int    $number The number to compare against to use either the singular or plural form.
     359 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
     360 *                       Default 'default'.
     361 *
     362 * @return string Translated text.
     363 */
     364function esc_html_n( $single, $plural, $number, $domain = 'default' ) {
     365        return esc_html( __n( $single, $plural, $number, $domain = 'default' ) );
     366}
     367
     368/**
     369 * Translates and retrieves the singular or plural form based on the supplied number
     370 * and escapes it for safe use in an attribute.
     371 *
     372 * @since 4.7.0
     373 *
     374 * @param string $single The text to be used if the number is singular.
     375 * @param string $plural The text to be used if the number is plural.
     376 * @param int    $number The number to compare against to use either the singular or plural form.
     377 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
     378 *                       Default 'default'.
     379 *
     380 * @return string Translated text.
     381 */
     382function esc_attr_n( $single, $plural, $number, $domain = 'default' ) {
     383        return esc_attr( __n( $single, $plural, $number, $domain = 'default' ) );
     384}
     385
     386/**
    351387 * Translates and retrieves the singular or plural form based on the supplied number, with gettext context.
    352388 *
    353389 * This is a hybrid of _n() and _x(). It supports context and plurals.