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.
Built from https://develop.svn.wordpress.org/trunk@53501


git-svn-id: http://core.svn.wordpress.org/trunk@53090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2022-06-14 14:43:12 +00:00
parent cc05e7b608
commit 3f74637dfe
5 changed files with 31 additions and 20 deletions

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'] ) {