Make WordPress Core


Ignore:
Timestamp:
09/01/2019 05:12:43 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-users-list-table.php

    r45407 r45926  
    195195
    196196        $role_links        = array();
    197         $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>';
     197        $role_links['all'] = sprintf(
     198            '<a href="%s"%s>%s</a>',
     199            $url,
     200            $current_link_attributes,
     201            sprintf(
     202                /* translators: %s: number of users */
     203                _nx(
     204                    'All <span class="count">(%s)</span>',
     205                    'All <span class="count">(%s)</span>',
     206                    $total_users,
     207                    'users'
     208                ),
     209                number_format_i18n( $total_users )
     210            )
     211        );
     212
    198213        foreach ( $wp_roles->get_names() as $this_role => $name ) {
    199214            if ( ! isset( $avail_roles[ $this_role ] ) ) {
     
    464479
    465480            // Set up the checkbox ( because the user is editable, otherwise it's empty )
    466             $checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
    467                         . "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role_classes}' value='{$user_object->ID}' />";
     481            $checkbox = sprintf(
     482                '<label class="screen-reader-text" for="user_%1$s">%2$s</label>' .
     483                '<input type="checkbox" name="users[]" id="user_%1$s" class="%3$s" value="%1$s" />',
     484                $user_object->ID,
     485                /* translators: %s: user login */
     486                sprintf( __( 'Select %s' ), $user_object->user_login ),
     487                $role_classes
     488            );
    468489
    469490        } else {
    470491            $edit = "<strong>{$user_object->user_login}{$super_admin}</strong>";
    471492        }
     493
    472494        $avatar = get_avatar( $user_object->ID, 32 );
    473495
     
    512534                            $r .= $user_object->last_name;
    513535                        } else {
    514                             $r .= '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . _x( 'Unknown', 'name' ) . '</span>';
     536                            $r .= sprintf(
     537                                '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">%s</span>',
     538                                _x( 'Unknown', 'name' )
     539                            );
    515540                        }
    516541                        break;
     
    523548                    case 'posts':
    524549                        if ( $numposts > 0 ) {
    525                             $r .= "<a href='edit.php?author=$user_object->ID' class='edit'>";
    526                             $r .= '<span aria-hidden="true">' . $numposts . '</span>';
    527                             $r .= '<span class="screen-reader-text">' . sprintf( _n( '%s post by this author', '%s posts by this author', $numposts ), number_format_i18n( $numposts ) ) . '</span>';
    528                             $r .= '</a>';
     550                            $r .= sprintf(
     551                                '<a href="%s" class="edit"><span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',
     552                                "edit.php?author={$user_object->ID}",
     553                                $numposts,
     554                                sprintf(
     555                                    /* translators: %s: number of posts */
     556                                    _n( '%s post by this author', '%s posts by this author', $numposts ),
     557                                    number_format_i18n( $numposts )
     558                                )
     559                            );
    529560                        } else {
    530561                            $r .= 0;
Note: See TracChangeset for help on using the changeset viewer.