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
This commit is contained in:
Sergey Biryukov 2019-06-15 18:56:47 +00:00
parent 31d865271b
commit 69fabdbd4d
3 changed files with 29 additions and 17 deletions

View File

@ -86,12 +86,17 @@ if ( isset( $_GET['update'] ) ) {
} }
} }
if ( empty( $edit_link ) ) { $message = __( 'User added.' );
$messages[] = __( 'User added.' );
} else { if ( $edit_link ) {
/* translators: %s: edit page url */ $message .= sprintf(
$messages[] = sprintf( __( 'User added. <a href="%s">Edit user</a>' ), $edit_link ); ' <a href="%s">%s</a>',
$edit_link,
__( 'Edit user' )
);
} }
$messages[] = $message;
} }
} }

View File

@ -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.' ); $messages[] = __( 'Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.' );
break; break;
case 'addnoconfirmation': case 'addnoconfirmation':
if ( empty( $edit_link ) ) { $message = __( 'User has been added to your site.' );
$messages[] = __( 'User has been added to your site.' );
} else { if ( $edit_link ) {
/* translators: %s: edit page url */ $message .= sprintf(
$messages[] = sprintf( __( 'User has been added to your site. <a href="%s">Edit user</a>' ), $edit_link ); ' <a href="%s">%s</a>',
$edit_link,
__( 'Edit user' )
);
} }
$messages[] = $message;
break; break;
case 'addexisting': case 'addexisting':
$messages[] = __( 'That user is already a member of this site.' ); $messages[] = __( 'That user is already a member of this site.' );

View File

@ -483,21 +483,23 @@ switch ( $wp_list_table->current_action() ) {
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>'; $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
break; break;
case 'add': case 'add':
$message = __( 'New user created.' );
if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) { if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
/* translators: %s: edit page url */ $message .= sprintf(
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( ' <a href="%s">%s</a>',
__( 'New user created. <a href="%s">Edit user</a>' ),
esc_url( esc_url(
add_query_arg( add_query_arg(
'wp_http_referer', 'wp_http_referer',
urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
self_admin_url( 'user-edit.php?user_id=' . $user_id ) self_admin_url( 'user-edit.php?user_id=' . $user_id )
) )
) ),
) . '</p></div>'; __( 'Edit user' )
} else { );
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>';
} }
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . $message . '</p></div>';
break; break;
case 'promote': case 'promote':
$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>'; $messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Changed roles.' ) . '</p></div>';