Make WordPress Core


Ignore:
Timestamp:
09/01/2019 05:12:43 PM (7 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/dashboard.php

    r45883 r45926  
    270270                if ( $num_posts && $num_posts->publish ) {
    271271                        if ( 'post' == $post_type ) {
     272                                /* translators: %s: number of posts */
    272273                                $text = _n( '%s Post', '%s Posts', $num_posts->publish );
    273274                        } else {
     275                                /* translators: %s: number of pages */
    274276                                $text = _n( '%s Page', '%s Pages', $num_posts->publish );
    275277                        }
     
    286288        $num_comm = wp_count_comments();
    287289        if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) {
     290                /* translators: %s: number of comments */
    288291                $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
    289292                ?>
     
    291294                <?php
    292295                $moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
    293                 /* translators: %s: number of comments in moderation */
     296                /* translators: %s: number of comments */
    294297                $text = sprintf( _n( '%s Comment in moderation', '%s Comments in moderation', $num_comm->moderated ), $moderated_comments_count_i18n );
    295298                ?>
     
    581584        echo '<div class="drafts">';
    582585        if ( count( $drafts ) > 3 ) {
    583                 echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '">' . __( 'View all drafts' ) . "</a></p>\n";
     586                printf(
     587                        '<p class="view-all"><a href="%s">%s</a></p>' . "\n",
     588                        esc_url( admin_url( 'edit.php?post_status=draft' ) ),
     589                        __( 'View all drafts' )
     590                );
    584591        }
    585592        echo '<h2 class="hide-if-no-js">' . __( 'Your Recent Drafts' ) . "</h2>\n<ul>";
     
    593600                $title = _draft_or_post_title( $draft->ID );
    594601                echo "<li>\n";
    595                 /* translators: %s: post title */
    596                 echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . esc_html( $title ) . '</a>';
    597                 echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>';
     602                printf(
     603                        '<div class="draft-title"><a href="%s" aria-label="%s">%s</a><time datetime="%s">%s</time></div>',
     604                        esc_url( $url ),
     605                        /* translators: %s: post title */
     606                        esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ),
     607                        esc_html( $title ),
     608                        get_the_time( 'c', $draft ),
     609                        get_the_time( __( 'F j, Y' ), $draft )
     610                );
    598611                $the_content = wp_trim_words( $draft->post_content, $draft_length );
    599612                if ( $the_content ) {
     
    14961509        if ( $response ) {
    14971510                if ( $response['insecure'] ) {
    1498                         /* translators: %s: browser name and link */
    14991511                        $msg = sprintf(
     1512                                /* translators: %s: browser name and link */
    15001513                                __( "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ),
    15011514                                sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) )
    15021515                        );
    15031516                } else {
    1504                         /* translators: %s: browser name and link */
    15051517                        $msg = sprintf(
     1518                                /* translators: %s: browser name and link */
    15061519                                __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ),
    15071520                                sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) )
     
    15241537                }
    15251538
    1526                 $notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>';
     1539                $notice .= '<p>' . sprintf(
     1540                        /* translators: 1: browser update URL, 2: browser name, 3: Browse Happy URL */
     1541                        __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ),
     1542                        esc_attr( $response['update_url'] ),
     1543                        esc_html( $response['name'] ),
     1544                        esc_url( $browsehappy )
     1545                ) . '</p>';
    15271546                $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>';
    15281547                $notice .= '<div class="clear"></div>';
     
    16981717                <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
    16991718                        <?php $themes_link = current_user_can( 'customize' ) ? add_query_arg( 'autofocus[panel]', 'themes', admin_url( 'customize.php' ) ) : admin_url( 'themes.php' ); ?>
    1700                         <p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), $themes_link ); ?></p>
     1719                        <p class="hide-if-no-customize">
     1720                                <?php
     1721                                        /* translators: %s: URL to Themes panel in Customizer or Themes screen */
     1722                                        printf( __( 'or, <a href="%s">change your theme completely</a>' ), $themes_link );
     1723                                ?>
     1724                        </p>
    17011725                <?php endif; ?>
    17021726        </div>
     
    17261750                        if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) {
    17271751                                $widgets_menus_link = sprintf(
     1752                                        /* translators: 1: URL to Widgets screen, 2: URL to Menus screen */
    17281753                                        __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ),
    17291754                                        admin_url( 'widgets.php' ),
Note: See TracChangeset for help on using the changeset viewer.