From c008959e9ed2c14e4c2a6332eb8ca670e484820d Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Fri, 11 Jan 2019 06:04:49 +0000 Subject: [PATCH] Coding Standards: Fix the minor `WordPress.WP.I18n` violations. `WordPress.WP.I18n.MissingTranslatorsComment` is in progress in #44360. See #45934. Built from https://develop.svn.wordpress.org/trunk@44562 git-svn-id: http://core.svn.wordpress.org/trunk@44393 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/credits.php | 3 +++ wp-admin/includes/import.php | 2 ++ wp-admin/includes/plugin.php | 1 + wp-content/themes/twentyeleven/comments.php | 11 ++++++++++- wp-content/themes/twentyten/comments.php | 19 ++++++++++++++----- wp-content/themes/twentythirteen/comments.php | 11 ++++++++++- wp-content/themes/twentytwelve/comments.php | 11 ++++++++++- wp-includes/category-template.php | 2 ++ wp-includes/class-wp-theme.php | 2 ++ wp-includes/functions.php | 2 ++ wp-includes/post.php | 1 + wp-includes/version.php | 2 +- 12 files changed, 58 insertions(+), 9 deletions(-) diff --git a/wp-admin/credits.php b/wp-admin/credits.php index be36bdb368..92073d9776 100644 --- a/wp-admin/credits.php +++ b/wp-admin/credits.php @@ -65,8 +65,10 @@ foreach ( $credits['groups'] as $group_slug => $group_data ) { // Considered a special slug in the API response. (Also, will never be returned for en_US.) $title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' ); } elseif ( isset( $group_data['placeholders'] ) ) { + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] ); } else { + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $title = translate( $group_data['name'] ); } @@ -100,6 +102,7 @@ foreach ( $credits['groups'] as $group_slug => $group_data ) { echo '' . "\n"; echo esc_html( $person_data[0] ) . "\n\t"; if ( ! $compact ) { + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText echo '' . translate( $person_data[3] ) . "\n"; } echo "\n"; diff --git a/wp-admin/includes/import.php b/wp-admin/includes/import.php index e050a43fe3..e1aac052fa 100644 --- a/wp-admin/includes/import.php +++ b/wp-admin/includes/import.php @@ -167,8 +167,10 @@ function wp_get_popular_importers() { } foreach ( $popular_importers['importers'] as &$importer ) { + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $importer['description'] = translate( $importer['description'] ); if ( $importer['name'] != 'WordPress' ) { + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $importer['name'] = translate( $importer['name'] ); } } diff --git a/wp-admin/includes/plugin.php b/wp-admin/includes/plugin.php index 412c5330e4..6c7b62db93 100644 --- a/wp-admin/includes/plugin.php +++ b/wp-admin/includes/plugin.php @@ -137,6 +137,7 @@ function _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup } if ( $textdomain ) { foreach ( array( 'Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field ) { + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain $plugin_data[ $field ] = translate( $plugin_data[ $field ], $textdomain ); } } diff --git a/wp-content/themes/twentyeleven/comments.php b/wp-content/themes/twentyeleven/comments.php index 68028598be..208806b67f 100644 --- a/wp-content/themes/twentyeleven/comments.php +++ b/wp-content/themes/twentyeleven/comments.php @@ -31,11 +31,20 @@

' . get_the_title() . '' + ); + } else { + printf( + /* translators: %1$s: The number of comments. %2$s: The post title. */ + _n( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'twentyeleven' ), number_format_i18n( get_comments_number() ), '' . get_the_title() . '' ); + } ?>

diff --git a/wp-content/themes/twentyten/comments.php b/wp-content/themes/twentyten/comments.php index faabb40b5f..9006856323 100644 --- a/wp-content/themes/twentyten/comments.php +++ b/wp-content/themes/twentyten/comments.php @@ -34,11 +34,20 @@

' . get_the_title() . '' - ); + if ( 1 === get_comments_number() ) { + printf( + /* translators: %s: The post title. */ + __( 'One Response to %s', 'twentyten' ), + '' . get_the_title() . '' + ); + } else { + /* translators: %1$s: The number of comments. %2$s: The post title. */ + printf( + _n( '%1$s Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentyten' ), + number_format_i18n( get_comments_number() ), + '' . get_the_title() . '' + ); + } ?>

diff --git a/wp-content/themes/twentythirteen/comments.php b/wp-content/themes/twentythirteen/comments.php index 464235cc9e..6348145780 100644 --- a/wp-content/themes/twentythirteen/comments.php +++ b/wp-content/themes/twentythirteen/comments.php @@ -23,11 +23,20 @@ if ( post_password_required() ) {

' . get_the_title() . '' + ); + } else { + printf( + /* translators: %1$s: The number of comments. %2$s: The post title. */ + _nx( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'comments title', 'twentythirteen' ), number_format_i18n( get_comments_number() ), '' . get_the_title() . '' ); + } ?>

diff --git a/wp-content/themes/twentytwelve/comments.php b/wp-content/themes/twentytwelve/comments.php index 010c1aedf4..5537fc460c 100644 --- a/wp-content/themes/twentytwelve/comments.php +++ b/wp-content/themes/twentytwelve/comments.php @@ -29,11 +29,20 @@ if ( post_password_required() ) {

' . get_the_title() . '' + ); + } else { + printf( + /* translators: %1$s: The number of comments. %2$s: The post title. */ + _n( '%1$s thought on “%2$s”', '%1$s thoughts on “%2$s”', get_comments_number(), 'twentytwelve' ), number_format_i18n( get_comments_number() ), '' . get_the_title() . '' ); + } ?>

diff --git a/wp-includes/category-template.php b/wp-includes/category-template.php index dac1f5a55d..3881f0e033 100644 --- a/wp-includes/category-template.php +++ b/wp-includes/category-template.php @@ -836,12 +836,14 @@ function wp_generate_tag_cloud( $tags, $args = '' ) { } elseif ( ! empty( $args['topic_count_text_callback'] ) ) { // Look for the alternative callback style. Ignore the previous default. if ( $args['topic_count_text_callback'] === 'default_topic_count_text' ) { + // wpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural $translate_nooped_plural = _n_noop( '%s item', '%s items' ); } else { $translate_nooped_plural = false; } } elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) { // If no callback exists, look for the old-style single_text and multiple_text arguments. + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural $translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] ); } else { // This is the default for when no callback, plural, or argument is passed in. diff --git a/wp-includes/class-wp-theme.php b/wp-includes/class-wp-theme.php index 8b9c2c8815..0bdd6a43e3 100644 --- a/wp-includes/class-wp-theme.php +++ b/wp-includes/class-wp-theme.php @@ -874,6 +874,7 @@ final class WP_Theme implements ArrayAccess { if ( isset( $this->name_translated ) ) { return $this->name_translated; } + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain $this->name_translated = translate( $value, $this->get( 'TextDomain' ) ); return $this->name_translated; case 'Tags': @@ -925,6 +926,7 @@ final class WP_Theme implements ArrayAccess { return $value; default: + // phpcs:ignore WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText,WordPress.WP.I18n.NonSingularStringLiteralDomain $value = translate( $value, $this->get( 'TextDomain' ) ); } return $value; diff --git a/wp-includes/functions.php b/wp-includes/functions.php index c790f3df39..66e1921ac7 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -5073,6 +5073,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) { $exists[4] = ( $exists[1] && $exists[3] ); $exists[5] = ( $exists[2] && $exists[3] ); + // phpcs:disable WordPress.WP.I18n.LowLevelTranslationFunction,WordPress.WP.I18n.NonSingularStringLiteralText $zonen[] = array( 'continent' => ( $exists[0] ? $zone[0] : '' ), 'city' => ( $exists[1] ? $zone[1] : '' ), @@ -5081,6 +5082,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) { 't_city' => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ), 't_subcity' => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' ), ); + // phpcs:enable } usort( $zonen, '_wp_timezone_choice_usort_callback' ); diff --git a/wp-includes/post.php b/wp-includes/post.php index 565c243bbc..41fc4709a3 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -1037,6 +1037,7 @@ function register_post_status( $post_status, $args = array() ) { } if ( false === $args->label_count ) { + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralSingle,WordPress.WP.I18n.NonSingularStringLiteralPlural $args->label_count = _n_noop( $args->label, $args->label ); } diff --git a/wp-includes/version.php b/wp-includes/version.php index 4199920e29..79fca6679c 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-beta1-44561'; +$wp_version = '5.1-beta1-44562'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.