I18N: Use a translatable string for displaying a user's first name and last name.

That allows locales to switch the order of the first name and last name, should they prefer to do so.

The string was previously used in `wp_insert_user()` and is now reused in other places for consistency:

* `WP_MS_Users_List_Table::column_name()`​
* `WP_Users_List_Table::column_name()​`
* `wp_list_authors()`
* `wp_list_users()`

Note: This also removes the `wp_list_author_full_name` filter, introduced for the same purpose in `wp_list_authors()`, as redundant for now.

Follow-up to [53486].

See #17025.

git-svn-id: https://develop.svn.wordpress.org/trunk@53501 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2022-06-14 14:41:10 +00:00
parent d60f4f9cab
commit 2d9073413f
4 changed files with 30 additions and 19 deletions
+12 -3
View File
@@ -827,7 +827,12 @@ function wp_list_users( $args = array() ) {
}
if ( $args['show_fullname'] && '' !== $user->first_name && '' !== $user->last_name ) {
$name = "$user->first_name $user->last_name";
$name = sprintf(
/* translators: 1: User's first name, 2: Last name. */
_x( '%1$s %2$s', 'Display name based on first name and last name' ),
$user->first_name,
$user->last_name
);
} else {
$name = $user->display_name;
}
@@ -2242,8 +2247,12 @@ function wp_insert_user( $userdata ) {
if ( $update ) {
$display_name = $user_login;
} elseif ( $meta['first_name'] && $meta['last_name'] ) {
/* translators: 1: User's first name, 2: Last name. */
$display_name = sprintf( _x( '%1$s %2$s', 'Display name based on first name and last name' ), $meta['first_name'], $meta['last_name'] );
$display_name = sprintf(
/* translators: 1: User's first name, 2: Last name. */
_x( '%1$s %2$s', 'Display name based on first name and last name' ),
$meta['first_name'],
$meta['last_name']
);
} elseif ( $meta['first_name'] ) {
$display_name = $meta['first_name'];
} elseif ( $meta['last_name'] ) {