Make WordPress Core

Ticket #49518: 49518.diff

File 49518.diff, 4.2 KB (added by garrett-eclipse, 3 years ago)

Updated patch for Coding Standards (adding new lines around each block) and updating @since and adding to function definition

  • src/wp-includes/l10n.php

     
    165165 * *Note:* Don't use translate() directly, use __() or related functions.
    166166 *
    167167 * @since 2.2.0
     168 * @since 5.5.0 Introduced gettext-{$domain} filter.
    168169 *
    169170 * @param string $text   Text to translate.
    170171 * @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
     
    176177        $translation  = $translations->translate( $text );
    177178
    178179        /**
     180         * Filters text with its translation for a domain.
     181         *
     182         * @since 5.5.0
     183         *
     184         * @param string $translation  Translated text.
     185         * @param string $text         Text to translate.
     186         */
     187        $translation = apply_filters( 'gettext-' . $domain, $translation, $text );
     188
     189        /**
    179190         * Filters text with its translation.
    180191         *
    181192         * @since 2.0.11
     
    215226 * *Note:* Don't use translate_with_gettext_context() directly, use _x() or related functions.
    216227 *
    217228 * @since 2.8.0
     229 * @since 5.5.0 Introduced gettext_with_context-{$domain} filter.
    218230 *
    219231 * @param string $text    Text to translate.
    220232 * @param string $context Context information for the translators.
     
    225237function translate_with_gettext_context( $text, $context, $domain = 'default' ) {
    226238        $translations = get_translations_for_domain( $domain );
    227239        $translation  = $translations->translate( $text, $context );
     240
    228241        /**
     242         * Filters text with its translation based on context information for a domain.
     243         *
     244         * @since 5.5.0
     245         *
     246         * @param string $translation  Translated text.
     247         * @param string $text         Text to translate.
     248         * @param string $context      Context information for the translators.
     249         */
     250        $translation = apply_filters( 'gettext_with_context-' . $domain, $translation, $text, $context );
     251
     252        /**
    229253         * Filters text with its translation based on context information.
    230254         *
    231255         * @since 2.8.0
     
    419443 *     printf( _n( '%s person', '%s people', $count, 'text-domain' ), number_format_i18n( $count ) );
    420444 *
    421445 * @since 2.8.0
     446 * @since 5.5.0 Introduced ngettext-{$domain} filter.
    422447 *
    423448 * @param string $single The text to be used if the number is singular.
    424449 * @param string $plural The text to be used if the number is plural.
     
    432457        $translation  = $translations->translate_plural( $single, $plural, $number );
    433458
    434459        /**
     460         * Filters the singular or plural form of a string for a domain.
     461         *
     462         * @since 5.5.0
     463         *
     464         * @param string $translation Translated text.
     465         * @param string $single      The text to be used if the number is singular.
     466         * @param string $plural      The text to be used if the number is plural.
     467         * @param string $number      The number to compare against to use either the singular or plural form.
     468         */
     469        $translation = apply_filters( 'ngettext-' . $domain, $translation, $single, $plural, $number );
     470
     471        /**
    435472         * Filters the singular or plural form of a string.
    436473         *
    437474         * @since 2.2.0
     
    459496 *     printf( _nx( '%s group', '%s groups', $animals, 'group of animals', 'text-domain' ), number_format_i18n( $animals ) );
    460497 *
    461498 * @since 2.8.0
     499 * @since 5.5.0 Introduced ngettext_with_context-{$domain} filter.
    462500 *
    463501 * @param string $single  The text to be used if the number is singular.
    464502 * @param string $plural  The text to be used if the number is plural.
     
    473511        $translation  = $translations->translate_plural( $single, $plural, $number, $context );
    474512
    475513        /**
     514         * Filters the singular or plural form of a string with gettext context for a domain.
     515         *
     516         * @since 5.5.0
     517         *
     518         * @param string $translation Translated text.
     519         * @param string $single      The text to be used if the number is singular.
     520         * @param string $plural      The text to be used if the number is plural.
     521         * @param string $number      The number to compare against to use either the singular or plural form.
     522         * @param string $context     Context information for the translators.
     523         */
     524        $translation = apply_filters( 'ngettext_with_context-' . $domain, $translation, $single, $plural, $number, $context );
     525
     526        /**
    476527         * Filters the singular or plural form of a string with gettext context.
    477528         *
    478529         * @since 2.8.0