diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist
index 6f6212eb..af71a3db 100644
--- a/.phpcs.xml.dist
+++ b/.phpcs.xml.dist
@@ -8,6 +8,13 @@
Note: To edit post authors, please enable javascript or use a javascript-capable browser', 'co-authors-plus' ), array( 'strong' => array() ) ); ?>
+Note: To edit post authors, please enable JavaScript or use a JavaScript-capable browser', 'co-authors-plus' ), array( 'strong' => array() ) ); ?>
get_coauthor_by( 'user_nicename', $author_slug ); - return sprintf( __( 'Author: %s' ), $author->display_name ); + /* translators: Author display name. */ + return sprintf( __( 'Author: %s', 'co-authors-plus' ), $author->display_name ); } /** @@ -1840,11 +1841,11 @@ public function filter_pre_get_avatar_data_url( $args, $id ) { if ( ! $id || ! $this->is_guest_authors_enabled() || ! is_numeric( $id ) || isset( $args['url'] ) ) { return $args; } - + // Do not filter the icon in the admin bar if ( doing_filter( 'admin_bar_menu' ) ) { return $args; - } + } // Do not filter when we have a WordPress user sent from CAP meta box if ( isset( $args['user_type'] ) && 'wp-user' === $args['user_type'] ) { @@ -1857,7 +1858,7 @@ public function filter_pre_get_avatar_data_url( $args, $id ) { return $args; } - + $coauthor = $this->get_coauthor_by( 'id', $id ); if ( false !== $coauthor && isset( $coauthor->type ) && 'guest-author' === $coauthor->type ) { if ( has_post_thumbnail( $id ) ) { @@ -1953,43 +1954,55 @@ function wp_notify_postauthor( $comment_id, $comment_type = '' ) { } if ( 'comment' == $comment_type ) { - $notify_message = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n"; + /* translators: Post title. */ + $notify_message = sprintf( __( 'New comment on your post "%s"', 'co-authors-plus' ), $post->post_title ) . "\r\n"; /* translators: 1: comment author, 2: author IP, 3: author domain */ - $notify_message .= sprintf( __( 'Author : %1$s (IP: %2$s , %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __( 'E-mail : %s' ), $comment->comment_author_email ) . "\r\n"; - $notify_message .= sprintf( __( 'URL : %s' ), $comment->comment_author_url ) . "\r\n"; - $notify_message .= sprintf( __( 'Whois : http://whois.arin.net/rest/ip/%s' ), $comment->comment_author_IP ) . "\r\n"; - $notify_message .= __( 'Comment: ' ) . "\r\n" . $comment->comment_content . "\r\n\r\n"; - $notify_message .= __( 'You can see all comments on this post here: ' ) . "\r\n"; + $notify_message .= sprintf( __( 'Author : %1$s (IP: %2$s , %3$s)', 'co-authors-plus' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + /* translators: Comment author emal address. */ + $notify_message .= sprintf( __( 'Email : %s', 'co-authors-plus' ), $comment->comment_author_email ) . "\r\n"; + /* translators: Comment author URL. */ + $notify_message .= sprintf( __( 'URL : %s', 'co-authors-plus' ), $comment->comment_author_url ) . "\r\n"; + /* translators: Comment author IP address. */ + $notify_message .= sprintf( __( 'Whois : http://whois.arin.net/rest/ip/%s', 'co-authors-plus' ), $comment->comment_author_IP ) . "\r\n"; + $notify_message .= __( 'Comment: ', 'co-authors-plus' ) . "\r\n" . $comment->comment_content . "\r\n\r\n"; + $notify_message .= __( 'You can see all comments on this post here: ', 'co-authors-plus' ) . "\r\n"; /* translators: 1: blog name, 2: post title */ - $subject = sprintf( __( '[%1$s] Comment: "%2$s"' ), $blogname, $post->post_title ); + $subject = sprintf( __( '[%1$s] Comment: "%2$s"', 'co-authors-plus' ), $blogname, $post->post_title ); } elseif ( 'trackback' == $comment_type ) { - $notify_message = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n"; - /* translators: 1: website name, 2: author IP, 3: author domain */ - $notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s , %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __( 'URL : %s' ), $comment->comment_author_url ) . "\r\n"; - $notify_message .= __( 'Excerpt: ' ) . "\r\n" . $comment->comment_content . "\r\n\r\n"; - $notify_message .= __( 'You can see all trackbacks on this post here: ' ) . "\r\n"; + /* translators: Post title. */ + $notify_message = sprintf( __( 'New trackback on your post "%s"', 'co-authors-plus' ), $post->post_title ) . "\r\n"; + /* translators: 1: comment author, 2: author IP, 3: author domain */ + $notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s , %3$s)', 'co-authors-plus' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + /* translators: Comment author URL. */ + $notify_message .= sprintf( __( 'URL : %s', 'co-authors-plus' ), $comment->comment_author_url ) . "\r\n"; + $notify_message .= __( 'Excerpt: ', 'co-authors-plus' ) . "\r\n" . $comment->comment_content . "\r\n\r\n"; + $notify_message .= __( 'You can see all trackbacks on this post here: ', 'co-authors-plus' ) . "\r\n"; /* translators: 1: blog name, 2: post title */ - $subject = sprintf( __( '[%1$s] Trackback: "%2$s"' ), $blogname, $post->post_title ); + $subject = sprintf( __( '[%1$s] Trackback: "%2$s"', 'co-authors-plus' ), $blogname, $post->post_title ); } elseif ( 'pingback' == $comment_type ) { - $notify_message = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n"; + /* translators: Post title. */ + $notify_message = sprintf( __( 'New pingback on your post "%s"', 'co-authors-plus' ), $post->post_title ) . "\r\n"; /* translators: 1: comment author, 2: author IP, 3: author domain */ - $notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s , %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; - $notify_message .= sprintf( __( 'URL : %s' ), $comment->comment_author_url ) . "\r\n"; - $notify_message .= __( 'Excerpt: ' ) . "\r\n" . sprintf( '[...] %s [...]', $comment->comment_content ) . "\r\n\r\n"; - $notify_message .= __( 'You can see all pingbacks on this post here: ' ) . "\r\n"; + $notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s , %3$s)', 'co-authors-plus' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n"; + /* translators: Comment author URL. */ + $notify_message .= sprintf( __( 'URL : %s', 'co-authors-plus' ), $comment->comment_author_url ) . "\r\n"; + $notify_message .= __( 'Excerpt: ', 'co-authors-plus' ) . "\r\n" . sprintf( '[...] %s [...]', $comment->comment_content ) . "\r\n\r\n"; + $notify_message .= __( 'You can see all pingbacks on this post here: ', 'co-authors-plus' ) . "\r\n"; /* translators: 1: blog name, 2: post title */ - $subject = sprintf( __( '[%1$s] Pingback: "%2$s"' ), $blogname, $post->post_title ); + $subject = sprintf( __( '[%1$s] Pingback: "%2$s"', 'co-authors-plus' ), $blogname, $post->post_title ); } $notify_message .= get_permalink( $comment->comment_post_ID ) . "#comments\r\n\r\n"; - $notify_message .= sprintf( __( 'Permalink: %s' ), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n"; + /* translators: Comment URL. */ + $notify_message .= sprintf( __( 'Permalink: %s', 'co-authors-plus' ), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n"; if ( EMPTY_TRASH_DAYS ) { - $notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c=$comment_id" ) ) . "\r\n"; + /* translators: URL for trashing a comment. */ + $notify_message .= sprintf( __( 'Trash it: %s', 'co-authors-plus' ), admin_url( "comment.php?action=trash&c=$comment_id" ) ) . "\r\n"; } else { - $notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c=$comment_id" ) ) . "\r\n"; + /* translators: URL for deleting a comment. */ + $notify_message .= sprintf( __( 'Delete it: %s', 'co-authors-plus' ), admin_url( "comment.php?action=delete&c=$comment_id" ) ) . "\r\n"; } - $notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c=$comment_id" ) ) . "\r\n"; + /* translators: URL for marking a comment as spam. */ + $notify_message .= sprintf( __( 'Spam it: %s', 'co-authors-plus' ), admin_url( "comment.php?action=spam&c=$comment_id" ) ) . "\r\n"; $wp_email = 'wordpress@' . preg_replace( '#^www\.#', '', strtolower( $_SERVER['SERVER_NAME'] ) ); // phpcs:ignore diff --git a/languages/co-authors-plus.pot b/languages/co-authors-plus.pot index 2374c3d7..e5d08c13 100755 --- a/languages/co-authors-plus.pot +++ b/languages/co-authors-plus.pot @@ -1,574 +1,654 @@ -# Copyright (C) 2014 Co-Authors Plus -# This file is distributed under the same license as the Co-Authors Plus package. +# Copyright (C) 2023 Mohammad Jangda, Daniel Bachhuber, Automattic +# This file is distributed under the same license as the Co-Authors Plus plugin. msgid "" msgstr "" -"Project-Id-Version: Co-Authors Plus 3.1-beta\n" -"Report-Msgid-Bugs-To: http://wordpress.org/tag/co-authors-plus\n" -"POT-Creation-Date: 2014-03-17 15:59:18+00:00\n" +"Project-Id-Version: Co-Authors Plus 3.5.11\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/co-authors-plus\n" +"Last-Translator: FULL NAME' . esc_html( sprintf( __( 'You have specified this %s for deletion:', 'co-authors-plus' ), strtolower( $this->labels['singular'] ) ) ) . '
'; + echo '' . esc_html__( 'You have specified this guest author for deletion:', 'co-authors-plus' ) . '
'; echo '#' . esc_html( $guest_author->ID . ': ' . $guest_author->display_name ) . '
'; // display wording differently per post count if ( 0 === $count ) { - $post_count_message = '' . sprintf( __( 'There are no posts associated with this guest author.', 'co-authors-plus' ), strtolower( $this->labels['singular'] ) ) . '
'; + $post_count_message = '' . esc_html__( 'There are no posts associated with this guest author.', 'co-authors-plus' ) . '
'; } else { - $note = '' . sprintf( __( "Note: If you'd like to delete the %1\$s and all of their posts, you should delete their posts first and then come back to delete the %2\$s.", 'co-authors-plus' ), strtolower( $this->labels['singular'] ), strtolower( $this->labels['singular'] ) ) . '
'; - if ( 1 === $count ) { - $post_count_message = '' . sprintf( __( 'There is %1$d post associated with this guest author. What should be done with the post assigned to this %2$s?', 'co-authors-plus' ), $count, strtolower( $this->labels['singular'] ) ) . '
'; - } else { - $post_count_message = '' . sprintf( __( 'There are %1$d posts associated with this guest author. What should be done with the posts assigned to this %2$s?', 'co-authors-plus' ), $count, strtolower( $this->labels['singular'] ) ) . '
'; - } - $post_count_message .= $note; + $note = '' . __( "Note: If you'd like to delete the guest author and all of their posts, you should delete their posts first and then come back to delete the guest author.", 'co-authors-plus' ) . '
'; + $post_count_message_text = sprintf( + /* translators: Count of posts */ + _n( + 'There is %d post associated with this guest author. What should be done with the post assigned to this Guest Author?', + 'There are %d posts associated with this guest author. What should be done with the posts assigned to this Guest Author?', + $count, + 'co-authors-plus' + ), + number_format_i18n( $count ) + ); + $post_count_message = '' . $post_count_message_text . '
' . $note; } $allowed_html = array( 'p' => array( @@ -524,6 +534,7 @@ function view_guest_authors_list() { // Leave mapped to a linked account if ( get_user_by( 'login', $guest_author->linked_account ) ) { echo ''; } @@ -1240,6 +1251,7 @@ function create( $args ) { // Make sure required fields are there if ( isset( $field['required'] ) && $field['required'] && empty( $args[ $field['key'] ] ) ) { + /* translators: Name of a form field. */ return new WP_Error( 'field-required', sprintf( __( '%s is a required field', 'co-authors-plus' ), $field['key'] ) ); } diff --git a/php/class-wp-cli.php b/php/class-wp-cli.php index fa8dff0e..db74b7d8 100644 --- a/php/class-wp-cli.php +++ b/php/class-wp-cli.php @@ -233,7 +233,7 @@ public function assign_user_to_coauthor( $args, $assoc_args ) { } $post_types = implode( "','", $coauthors_plus->supported_post_types ); - // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching + // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared,WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching $posts = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author=%d AND post_type IN ({$post_types})", $user->ID ) ); $affected = 0; foreach ( $posts as $post_id ) { @@ -241,6 +241,7 @@ public function assign_user_to_coauthor( $args, $assoc_args ) { if ( ! empty( $coauthors ) ) { WP_CLI::line( sprintf( + /* translators: 1: Post ID, 2: Comma-separated list of co-author slugs. */ __( 'Skipping - Post #%1$d already has co-authors assigned: %2$s', 'co-authors-plus' ), $post_id, implode( ', ', wp_list_pluck( $coauthors, 'slug' ) ) @@ -250,13 +251,25 @@ public function assign_user_to_coauthor( $args, $assoc_args ) { } $coauthors_plus->add_coauthors( $post_id, array( $coauthor->user_login ) ); + /* translators: 1: Co-author login, 2: Post ID */ WP_CLI::line( sprintf( __( "Updating - Adding %1\$s's byline to post #%2\$d", 'co-authors-plus' ), $coauthor->user_login, $post_id ) ); $affected++; if ( $affected && 0 === $affected % 100 ) { sleep( 2 ); } } - WP_CLI::success( sprintf( __( 'All done! %d posts were affected.', 'co-authors-plus' ), $affected ) ); + + $success_message = sprintf( + /* translators: Count of posts. */ + _n( + 'All done! %d post was affected.', + 'All done! %d posts were affected.', + $affected, + 'co-authors-plus' + ), + number_format_i18n( $affected ) + ); + WP_CLI::success( $success_message ); } @@ -884,7 +897,7 @@ private function create_guest_author( $author ) { } if ( $guest_author ) { - // translators: Guest Author ID. + /* translators: Guest Author ID. */ return WP_CLI::warning( sprintf( esc_html__( '-- Author already exists (ID #%s); skipping.', 'co-authors-plus' ), $guest_author->ID ) ); } @@ -904,7 +917,7 @@ private function create_guest_author( $author ) { ); if ( is_wp_error( $guest_author_id ) ) { - // translators: The error message. + /* translators: The error message. */ return WP_CLI::warning( sprintf( esc_html__( '-- Failed to create guest author: %s', 'co-authors-plus' ), $guest_author_id->get_error_message() ) ); } @@ -914,7 +927,7 @@ private function create_guest_author( $author ) { update_post_meta( $guest_author_id, '_original_author_login', $author['user_login'] ); - // translators: Guest Author ID. + /* translators: Guest Author ID. */ WP_CLI::success( sprintf( esc_html__( '-- Created as guest author #%s', 'co-authors-plus' ), $guest_author_id ) ); } diff --git a/php/integrations/yoast.php b/php/integrations/yoast.php index 208b4387..252ba371 100644 --- a/php/integrations/yoast.php +++ b/php/integrations/yoast.php @@ -259,7 +259,7 @@ public static function filter_slack_data( $data, $presentation ) { } $output = self::get_authors_display_names_output( $author_objects ); - $data[ \__( 'Written by', 'wordpress-seo' ) ] = $output; + $data[ \__( 'Written by', 'co-authors-plus' ) ] = $output; return $data; } diff --git a/template-tags.php b/template-tags.php index c16d0de5..ab28b707 100644 --- a/template-tags.php +++ b/template-tags.php @@ -95,7 +95,7 @@ function __construct( $postID = 0 ) { } if ( ! $postID ) { - trigger_error( esc_html__( 'No post ID provided for CoAuthorsIterator constructor. Are you not in a loop or is $post not set?', 'co-authors-plus' ) ); // return null; + trigger_error( esc_html( 'No post ID provided for CoAuthorsIterator constructor. Are you not in a loop or is $post not set?' ) ); // return null; } $this->original_authordata = $this->current_author = $authordata; @@ -299,6 +299,7 @@ function coauthors_posts_links_single( $author ) { 'before_html' => '', 'href' => get_author_posts_url( $author->ID, $author->user_nicename ), 'rel' => 'author', + /* translators: Author display name. */ 'title' => sprintf( __( 'Posts by %s', 'co-authors-plus' ), apply_filters( 'the_author', $author->display_name ) ), 'class' => 'author url fn', 'text' => apply_filters( 'the_author', $author->display_name ), @@ -468,14 +469,16 @@ function coauthors_links_single( $author ) { return sprintf( '%s', esc_url( get_the_author_meta( 'website' ) ), - esc_attr( sprintf( __( 'Visit %s’s website' ), esc_html( get_the_author() ) ) ), + /* translators: Author display name. */ + esc_attr( sprintf( __( 'Visit %s’s website', 'co-authors-plus' ), esc_html( get_the_author() ) ) ), esc_html( get_the_author() ) ); } elseif ( get_the_author_meta( 'url' ) ) { return sprintf( '%s', esc_url( get_the_author_meta( 'url' ) ), - esc_attr( sprintf( __( 'Visit %s’s website' ), esc_html( get_the_author() ) ) ), + /* translators: Author display name. */ + esc_attr( sprintf( __( 'Visit %s’s website', 'co-authors-plus' ), esc_html( get_the_author() ) ) ), esc_html( get_the_author() ) ); } else { @@ -690,6 +693,7 @@ function coauthors_wp_list_authors( $args = array() ) { $link = $name; } } else { + /* translators: Author display name. */ $link = '' . esc_html( $name ) . ''; if ( ( ! empty( $args['feed_image'] ) ) || ( ! empty( $args['feed'] ) ) ) { diff --git a/tests/test-coauthors-guest-authors.php b/tests/test-coauthors-guest-authors.php index 95aafa76..5c00ed44 100644 --- a/tests/test-coauthors-guest-authors.php +++ b/tests/test-coauthors-guest-authors.php @@ -482,7 +482,7 @@ public function test_handle_delete_guest_author_action_with_guest_author_existen // Back up $_POST. $_post_backup = $_POST; - $expected = sprintf( __( "%s can't be deleted because it doesn't exist.", 'co-authors-plus' ), $guest_author_obj->labels['singular'] ); + $expected = __( "Guest author can't be deleted because it doesn't exist.", 'co-authors-plus' ); // Back up current user. $current_user = get_current_user_id();