I18N: Improve translator comments.

* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2019-09-01 17:13:59 +00:00
parent 3ab18dba93
commit 16b8d91baa
140 changed files with 1907 additions and 543 deletions

View File

@@ -194,7 +194,22 @@ class WP_Users_List_Table extends WP_List_Table {
$current_link_attributes = empty( $role ) ? ' class="current" aria-current="page"' : '';
$role_links = array();
$role_links['all'] = "<a href='$url'$current_link_attributes>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
$role_links['all'] = sprintf(
'<a href="%s"%s>%s</a>',
$url,
$current_link_attributes,
sprintf(
/* translators: %s: number of users */
_nx(
'All <span class="count">(%s)</span>',
'All <span class="count">(%s)</span>',
$total_users,
'users'
),
number_format_i18n( $total_users )
)
);
foreach ( $wp_roles->get_names() as $this_role => $name ) {
if ( ! isset( $avail_roles[ $this_role ] ) ) {
continue;
@@ -463,12 +478,19 @@ class WP_Users_List_Table extends WP_List_Table {
$role_classes = esc_attr( implode( ' ', array_keys( $user_roles ) ) );
// Set up the checkbox ( because the user is editable, otherwise it's empty )
$checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
. "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role_classes}' value='{$user_object->ID}' />";
$checkbox = sprintf(
'<label class="screen-reader-text" for="user_%1$s">%2$s</label>' .
'<input type="checkbox" name="users[]" id="user_%1$s" class="%3$s" value="%1$s" />',
$user_object->ID,
/* translators: %s: user login */
sprintf( __( 'Select %s' ), $user_object->user_login ),
$role_classes
);
} else {
$edit = "<strong>{$user_object->user_login}{$super_admin}</strong>";
}
$avatar = get_avatar( $user_object->ID, 32 );
// Comma-separated list of user roles.
@@ -511,7 +533,10 @@ class WP_Users_List_Table extends WP_List_Table {
} elseif ( $user_object->last_name ) {
$r .= $user_object->last_name;
} else {
$r .= '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
$r .= sprintf(
'<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
_x( 'Unknown', 'name' )
);
}
break;
case 'email':
@@ -522,10 +547,16 @@ class WP_Users_List_Table extends WP_List_Table {
break;
case 'posts':
if ( $numposts > 0 ) {
$r .= "<a href='edit.php?author=$user_object->ID' class='edit'>";
$r .= '<span aria-hidden="true">' . $numposts . '</span>';
$r .= '<span class="screen-reader-text">' . sprintf( _n( '%s post by this author', '%s posts by this author', $numposts ), number_format_i18n( $numposts ) ) . '</span>';
$r .= '</a>';
$r .= sprintf(
'<a href="%s" class="edit"><span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
"edit.php?author={$user_object->ID}",
$numposts,
sprintf(
/* translators: %s: number of posts */
_n( '%s post by this author', '%s posts by this author', $numposts ),
number_format_i18n( $numposts )
)
);
} else {
$r .= 0;
}