Make WordPress Core

Changeset 44562


Ignore:
Timestamp:
01/11/2019 06:03:46 AM (8 years ago)
Author:
pento
Message:

Coding Standards: Fix the minor WordPress.WP.I18n violations.

WordPress.WP.I18n.MissingTranslatorsComment is in progress in #44360.

See #45934.

Location:
trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/phpcs.xml.dist

    r44561 r44562  
    9191        <rule ref="WordPress.WP.I18n">
    9292                <exclude-pattern>/src/wp-includes/l10n\.php</exclude-pattern>
     93                <exclude-pattern>/tests/phpunit/tests/l10n\.php</exclude-pattern>
     94                <exclude-pattern>/tests/phpunit/tests/l10n/loadTextdomainJustInTime\.php</exclude-pattern>
    9395        </rule>
    9496
  • trunk/src/wp-admin/credits.php

    r44264 r44562  
    6666                        $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' );
    6767                } elseif ( isset( $group_data['placeholders'] ) ) {
     68                        // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
    6869                        $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );
    6970                } else {
     71                        // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
    7072                        $title = translate( $group_data['name'] );
    7173                }
     
    101103                                echo esc_html( $person_data[0] ) . "</a>\n\t";
    102104                                if ( ! $compact ) {
     105                                        // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
    103106                                        echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
    104107                                }
  • trunk/src/wp-admin/includes/import.php

    r43571 r44562  
    168168
    169169                foreach ( $popular_importers['importers'] as &$importer ) {
     170                        // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
    170171                        $importer['description'] = translate( $importer['description'] );
    171172                        if ( $importer['name'] != 'WordPress' ) {
     173                                // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
    172174                                $importer['name'] = translate( $importer['name'] );
    173175                        }
  • trunk/src/wp-admin/includes/plugin.php

    r44524 r44562  
    138138                if ( $textdomain ) {
    139139                        foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) {
     140                                // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
    140141                                $plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain );
    141142                        }
  • trunk/src/wp-content/themes/twentyeleven/comments.php

    r43571 r44562  
    3232                <h2 id="comments-title">
    3333                        <?php
     34                        if ( 1 === get_comments_number() ) {
    3435                                printf(
    35                                         _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyeleven' ),
     36                                        /* translators: %s: The post title. */
     37                                        __( 'One thought on &ldquo;%1$s&rdquo;', 'twentyeleven' ),
     38                                        '<span>' . get_the_title() . '</span>'
     39                                );
     40                        } else {
     41                                printf(
     42                                        /* translators: %1$s: The number of comments. %2$s: The post title. */
     43                                        _n( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentyeleven' ),
    3644                                        number_format_i18n( get_comments_number() ),
    3745                                        '<span>' . get_the_title() . '</span>'
    3846                                );
     47                        }
    3948                        ?>
    4049                </h2>
  • trunk/src/wp-content/themes/twentyten/comments.php

    r43571 r44562  
    3535                        <h3 id="comments-title">
    3636                        <?php
    37                         printf(
    38                                 _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),
    39                                 number_format_i18n( get_comments_number() ),
    40                                 '<em>' . get_the_title() . '</em>'
    41                         );
     37                        if ( 1 === get_comments_number() ) {
     38                                printf(
     39                                        /* translators: %s: The post title. */
     40                                        __( 'One Response to %s', 'twentyten' ),
     41                                        '<em>' . get_the_title() . '</em>'
     42                                );
     43                        } else {
     44                                /* translators: %1$s: The number of comments. %2$s: The post title. */
     45                                printf(
     46                                        _n( '%1$s Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ),
     47                                        number_format_i18n( get_comments_number() ),
     48                                        '<em>' . get_the_title() . '</em>'
     49                                );
     50                        }
    4251                        ?>
    4352                        </h3>
  • trunk/src/wp-content/themes/twentythirteen/comments.php

    r43571 r44562  
    2424                <h2 class="comments-title">
    2525                        <?php
     26                        if ( 1 === get_comments_number() ) {
    2627                                printf(
    27                                         _nx( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'twentythirteen' ),
     28                                        /* translators: %s: The post title. */
     29                                        _x( 'One thought on &ldquo;%s&rdquo;', 'comments title', 'twentythirteen' ),
     30                                        '<span>' . get_the_title() . '</span>'
     31                                );
     32                        } else {
     33                                printf(
     34                                        /* translators: %1$s: The number of comments. %2$s: The post title. */
     35                                        _nx( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'twentythirteen' ),
    2836                                        number_format_i18n( get_comments_number() ),
    2937                                        '<span>' . get_the_title() . '</span>'
    3038                                );
     39                        }
    3140                        ?>
    3241                </h2>
  • trunk/src/wp-content/themes/twentytwelve/comments.php

    r43571 r44562  
    3030                <h2 class="comments-title">
    3131                        <?php
     32                        if ( 1 === get_comments_number() ) {
    3233                                printf(
    33                                         _n( 'One thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ),
     34                                        /* translators: %s: The post title. */
     35                                        __( 'One thought on &ldquo;%s&rdquo;', 'twentytwelve' ),
     36                                        '<span>' . get_the_title() . '</span>'
     37                                );
     38                        } else {
     39                                printf(
     40                                        /* translators: %1$s: The number of comments. %2$s: The post title. */
     41                                        _n( '%1$s thought on &ldquo;%2$s&rdquo;', '%1$s thoughts on &ldquo;%2$s&rdquo;', get_comments_number(), 'twentytwelve' ),
    3442                                        number_format_i18n( get_comments_number() ),
    3543                                        '<span>' . get_the_title() . '</span>'
    3644                                );
     45                        }
    3746                        ?>
    3847                </h2>
  • trunk/src/wp-includes/category-template.php

    r43571 r44562  
    837837                // Look for the alternative callback style. Ignore the previous default.
    838838                if ( $args['topic_count_text_callback'] === 'default_topic_count_text' ) {
     839                        // wpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural
    839840                        $translate_nooped_plural = _n_noop( '%s item', '%s items' );
    840841                } else {
     
    843844        } elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
    844845                // If no callback exists, look for the old-style single_text and multiple_text arguments.
     846                // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural
    845847                $translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] );
    846848        } else {
  • trunk/src/wp-includes/class-wp-theme.php

    r44524 r44562  
    875875                                        return $this->name_translated;
    876876                                }
     877                                // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
    877878                                $this->name_translated = translate( $value, $this->get( 'TextDomain' ) );
    878879                                return $this->name_translated;
     
    926927
    927928                        default:
     929                                // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain
    928930                                $value = translate( $value, $this->get( 'TextDomain' ) );
    929931                }
  • trunk/src/wp-includes/functions.php

    r44546 r44562  
    50745074                $exists[5] = ( $exists[2] && $exists[3] );
    50755075
     5076                // phpcs:disable WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText
    50765077                $zonen[] = array(
    50775078                        'continent'   => ( $exists[0] ? $zone[0] : '' ),
     
    50825083                        't_subcity'   => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' ),
    50835084                );
     5085                // phpcs:enable
    50845086        }
    50855087        usort( $zonen, '_wp_timezone_choice_usort_callback' );
  • trunk/src/wp-includes/post.php

    r44546 r44562  
    10381038
    10391039        if ( false === $args->label_count ) {
     1040                // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural
    10401041                $args->label_count = _n_noop( $args->label, $args->label );
    10411042        }
Note: See TracChangeset for help on using the changeset viewer.