From 69fabdbd4d77fb29796743d04fd435ffe6220ea8 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 15 Jun 2019 18:56:47 +0000 Subject: [PATCH] I18N: Merge duplicate strings in notifications displayed when a new user has been created or added to the site. Props ramiy. Fixes #35746. git-svn-id: https://develop.svn.wordpress.org/trunk@45542 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/network/user-new.php | 15 ++++++++++----- src/wp-admin/user-new.php | 15 ++++++++++----- src/wp-admin/users.php | 16 +++++++++------- 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/src/wp-admin/network/user-new.php b/src/wp-admin/network/user-new.php index 73a4021b32..c71f795791 100644 --- a/src/wp-admin/network/user-new.php +++ b/src/wp-admin/network/user-new.php @@ -86,12 +86,17 @@ if ( isset( $_GET['update'] ) ) { } } - if ( empty( $edit_link ) ) { - $messages[] = __( 'User added.' ); - } else { - /* translators: %s: edit page url */ - $messages[] = sprintf( __( 'User added. Edit user' ), $edit_link ); + $message = __( 'User added.' ); + + if ( $edit_link ) { + $message .= sprintf( + ' %s', + $edit_link, + __( 'Edit user' ) + ); } + + $messages[] = $message; } } diff --git a/src/wp-admin/user-new.php b/src/wp-admin/user-new.php index 0d3743805d..9c63ee0f32 100644 --- a/src/wp-admin/user-new.php +++ b/src/wp-admin/user-new.php @@ -293,12 +293,17 @@ if ( isset( $_GET['update'] ) ) { $messages[] = __( 'Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.' ); break; case 'addnoconfirmation': - if ( empty( $edit_link ) ) { - $messages[] = __( 'User has been added to your site.' ); - } else { - /* translators: %s: edit page url */ - $messages[] = sprintf( __( 'User has been added to your site. Edit user' ), $edit_link ); + $message = __( 'User has been added to your site.' ); + + if ( $edit_link ) { + $message .= sprintf( + ' %s', + $edit_link, + __( 'Edit user' ) + ); } + + $messages[] = $message; break; case 'addexisting': $messages[] = __( 'That user is already a member of this site.' ); diff --git a/src/wp-admin/users.php b/src/wp-admin/users.php index 8827b73b35..14b713d9c2 100644 --- a/src/wp-admin/users.php +++ b/src/wp-admin/users.php @@ -483,21 +483,23 @@ switch ( $wp_list_table->current_action() ) { $messages[] = '

' . sprintf( $message, number_format_i18n( $delete_count ) ) . '

'; break; case 'add': + $message = __( 'New user created.' ); + if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) { - /* translators: %s: edit page url */ - $messages[] = '

' . sprintf( - __( 'New user created. Edit user' ), + $message .= sprintf( + ' %s', esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) - ) - ) . '

'; - } else { - $messages[] = '

' . __( 'New user created.' ) . '

'; + ), + __( 'Edit user' ) + ); } + + $messages[] = '

' . $message . '

'; break; case 'promote': $messages[] = '

' . __( 'Changed roles.' ) . '

';