WordPress.org

Make WordPress Core


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

    r45583 r45926  
    262262function install_dashboard() {
    263263    ?>
    264     <p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%1$s">WordPress Plugin Directory</a> or upload a plugin in .zip format by clicking the button at the top of this page.' ), __( 'https://wordpress.org/plugins/' ) ); ?></p>
     264    <p>
     265        <?php
     266        printf(
     267            /* translators: %s: https://wordpress.org/plugins/ */
     268            __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="%s">WordPress Plugin Directory</a> or upload a plugin in .zip format by clicking the button at the top of this page.' ),
     269            __( 'https://wordpress.org/plugins/' )
     270        );
     271        ?>
     272    </p>
    265273
    266274    <?php display_plugins_table(); ?>
     
    293301            $tags,
    294302            array(
     303                /* translators: %s: number of plugins */
    295304                'single_text'   => __( '%s plugin' ),
     305                /* translators: %s: number of plugins */
    296306                'multiple_text' => __( '%s plugins' ),
    297307            )
     
    391401        case 'install_plugins_beta':
    392402            printf(
     403                /* translators: %s: URL to "Features as Plugins" page */
    393404                '<p>' . __( 'You are using a development version of WordPress. These feature plugins are also under development. <a href="%s">Learn more</a>.' ) . '</p>',
    394405                'https://make.wordpress.org/core/handbook/about/release-cycle/features-as-plugins/'
     
    640651                <li><strong><?php _e( 'Last Updated:' ); ?></strong>
    641652                    <?php
    642                     /* translators: %s: Time since the last update */
     653                    /* translators: %s: Human-readable time difference */
    643654                    printf( __( '%s ago' ), human_time_diff( strtotime( $api->last_updated ) ) );
    644655                    ?>
     
    668679                    $active_installs_millions = floor( $api->active_installs / 1000000 );
    669680                    printf(
     681                        /* translators: %s: number of millions */
    670682                        _nx( '%s+ Million', '%s+ Million', $active_installs_millions, 'Active plugin installations' ),
    671683                        number_format_i18n( $active_installs_millions )
     
    697709            );
    698710            ?>
    699             <p aria-hidden="true" class="fyi-description"><?php printf( _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ), number_format_i18n( $api->num_ratings ) ); ?></p>
     711            <p aria-hidden="true" class="fyi-description">
     712                <?php
     713                printf(
     714                    /* translators: %s: number of ratings */
     715                    _n( '(based on %s rating)', '(based on %s ratings)', $api->num_ratings ),
     716                    number_format_i18n( $api->num_ratings )
     717                );
     718                ?>
     719            </p>
    700720            <?php
    701721        }
     
    708728            foreach ( $api->ratings as $key => $ratecount ) {
    709729                // Avoid div-by-zero.
    710                 $_rating = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
    711                 /* translators: 1: number of stars (used to determine singular/plural), 2: number of reviews */
     730                $_rating    = $api->num_ratings ? ( $ratecount / $api->num_ratings ) : 0;
    712731                $aria_label = esc_attr(
    713732                    sprintf(
    714                         _n( 'Reviews with %1$d star: %2$s. Opens in a new tab.', 'Reviews with %1$d stars: %2$s. Opens in a new tab.', $key ),
     733                        /* translators: 1: number of stars (used to determine singular/plural), 2: number of reviews */
     734                        _n(
     735                            'Reviews with %1$d star: %2$s. Opens in a new tab.',
     736                            'Reviews with %1$d stars: %2$s. Opens in a new tab.',
     737                            $key
     738                        ),
    715739                        $key,
    716740                        number_format_i18n( $ratecount )
     
    720744                <div class="counter-container">
    721745                        <span class="counter-label">
    722                             <a href="https://wordpress.org/support/plugin/<?php echo $api->slug; ?>/reviews/?filter=<?php echo $key; ?>"
    723                                 target="_blank" aria-label="<?php echo $aria_label; ?>"><?php printf( _n( '%d star', '%d stars', $key ), $key ); ?></a>
     746                            <?php
     747                            printf(
     748                                '<a href="%s" target="_blank" aria-label="%s">%s</a>',
     749                                "https://wordpress.org/support/plugin/{$api->slug}/reviews/?filter={$key}",
     750                                $aria_label,
     751                                /* translators: %s: number of stars */
     752                                sprintf( _n( '%d star', '%d stars', $key ), $key )
     753                            );
     754                            ?>
    724755                        </span>
    725756                        <span class="counter-back">
Note: See TracChangeset for help on using the changeset viewer.