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/update-core.php

    r45734 r45926  
    6262        } else {
    6363                if ( $current ) {
     64                        /* translators: %s: WordPress version */
    6465                        $message     = sprintf( __( 'If you need to re-install version %s, you can do so here:' ), $version_string );
    6566                        $submit      = __( 'Re-install Now' );
     
    7980                        );
    8081
    81                         /* translators: %s: Update PHP page URL */
    82                         $php_update_message = '</p><p>' . sprintf( __( '<a href="%s">Learn more about updating PHP</a>.' ), esc_url( wp_get_update_php_url() ) );
     82                        $php_update_message = '</p><p>' . sprintf(
     83                                /* translators: %s: Update PHP page URL */
     84                                __( '<a href="%s">Learn more about updating PHP</a>.' ),
     85                                esc_url( wp_get_update_php_url() )
     86                        );
    8387
    8488                        $annotation = wp_get_update_php_annotation();
     
    8892
    8993                        if ( ! $mysql_compat && ! $php_compat ) {
    90                                 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number */
    91                                 $message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ), $version_url, $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version ) . $php_update_message;
     94                                $message = sprintf(
     95                                        /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Minimum required MySQL version number, 5: Current PHP version number, 6: Current MySQL version number */
     96                                        __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher and MySQL version %4$s or higher. You are running PHP version %5$s and MySQL version %6$s.' ),
     97                                        $version_url,
     98                                        $update->current,
     99                                        $update->php_version,
     100                                        $update->mysql_version,
     101                                        $php_version,
     102                                        $mysql_version
     103                                ) . $php_update_message;
    92104                        } elseif ( ! $php_compat ) {
    93                                 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number */
    94                                 $message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ), $version_url, $update->current, $update->php_version, $php_version ) . $php_update_message;
     105                                $message = sprintf(
     106                                        /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required PHP version number, 4: Current PHP version number */
     107                                        __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires PHP version %3$s or higher. You are running version %4$s.' ),
     108                                        $version_url,
     109                                        $update->current,
     110                                        $update->php_version,
     111                                        $php_version
     112                                ) . $php_update_message;
    95113                        } elseif ( ! $mysql_compat ) {
    96                                 /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number */
    97                                 $message = sprintf( __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ), $version_url, $update->current, $update->mysql_version, $mysql_version );
     114                                $message = sprintf(
     115                                        /* translators: 1: URL to WordPress release notes, 2: WordPress version number, 3: Minimum required MySQL version number, 4: Current MySQL version number */
     116                                        __( 'You cannot update because <a href="%1$s">WordPress %2$s</a> requires MySQL version %3$s or higher. You are running version %4$s.' ),
     117                                        $version_url,
     118                                        $update->current,
     119                                        $update->mysql_version,
     120                                        $mysql_version
     121                                );
    98122                        } else {
    99                                 /* translators: 1: URL to WordPress release notes, 2: WordPress version number including locale if necessary */
    100                                 $message = sprintf( __( 'You can update to <a href="%1$s">WordPress %2$s</a> automatically:' ), $version_url, $version_string );
     123                                $message = sprintf(
     124                                        /* translators: 1: URL to WordPress release notes, 2: WordPress version number including locale if necessary */
     125                                        __( 'You can update to <a href="%1$s">WordPress %2$s</a> automatically:' ),
     126                                        $version_url,
     127                                        $version_string
     128                                );
    101129                        }
    102130                        if ( ! $mysql_compat || ! $php_compat ) {
     
    134162        } elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
    135163                // Partial builds don't need language-specific warnings.
    136                 echo '<p class="hint">' . sprintf( __( 'You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ), $update->response != 'development' ? $update->current : '' ) . '</p>';
     164                echo '<p class="hint">' . sprintf(
     165                        /* translators: %s: WordPress version */
     166                        __( 'You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.' ),
     167                        $update->response != 'development' ? $update->current : ''
     168                ) . '</p>';
    137169        }
    138170        echo '</form>';
     
    241273        } elseif ( ! $updates ) {
    242274                list( $normalized_version ) = explode( '-', $wp_version );
    243                 echo '<p>' . sprintf( __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
     275                echo '<p>' . sprintf(
     276                        /* translators: 1: URL to About screen, 2: WordPress version */
     277                        __( '<a href="%1$s">Learn more about WordPress %2$s</a>.' ),
     278                        esc_url( self_admin_url( 'about.php' ) ),
     279                        $normalized_version
     280                ) . '</p>';
    244281        }
    245282        dismissed_updates();
     
    300337                // Get plugin compat for running version of WordPress.
    301338                if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) {
    302                         $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $cur_wp_version );
     339                        /* translators: %s: WordPress version */
     340                        $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $cur_wp_version );
    303341                } else {
    304                         $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $cur_wp_version );
     342                        /* translators: %s: WordPress version */
     343                        $compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $cur_wp_version );
    305344                }
    306345                // Get plugin compat for updated version of WordPress.
    307346                if ( $core_update_version ) {
    308347                        if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
    309                                 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version );
     348                                /* translators: %s: WordPress version */
     349                                $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $core_update_version );
    310350                        } else {
    311                                 $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: Unknown' ), $core_update_version );
     351                                /* translators: %s: WordPress version */
     352                                $compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $core_update_version );
    312353                        }
    313354                }
     
    318359                if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
    319360                        $compat .= '<br>' . __( 'This update doesn&#8217;t work with your version of PHP.' ) . '&nbsp;';
    320                         /* translators: %s: Update PHP page URL */
    321361                        $compat .= sprintf(
     362                                /* translators: %s: Update PHP page URL */
    322363                                __( '<a href="%s">Learn more about updating PHP</a>.' ),
    323364                                esc_url( wp_get_update_php_url() )
     
    355396                        <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
    356397                        <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text">
    357                         <?php
     398                                <?php
    358399                                /* translators: %s: plugin name */
    359                                 printf(
    360                                         __( 'Select %s' ),
    361                                         $plugin_data->Name
    362                                 );
    363                         ?>
     400                                printf( __( 'Select %s' ), $plugin_data->Name );
     401                                ?>
    364402                        </label>
    365403                <?php endif; ?>
     
    369407                        <strong><?php echo $plugin_data->Name; ?></strong>
    370408                        <?php
    371                         /* translators: 1: plugin version, 2: new version */
    372409                        printf(
     410                                /* translators: 1: plugin version, 2: new version */
    373411                                __( 'You have version %1$s installed. Update to %2$s.' ),
    374412                                $plugin_data->Version,
     
    440478                        <input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
    441479                        <label for="<?php echo $checkbox_id; ?>" class="screen-reader-text">
    442                         <?php
     480                                <?php
    443481                                /* translators: %s: theme name */
    444                                 printf(
    445                                         __( 'Select %s' ),
    446                                         $theme->display( 'Name' )
    447                                 );
    448                         ?>
     482                                printf( __( 'Select %s' ), $theme->display( 'Name' ) );
     483                                ?>
    449484                        </label>
    450485                </td>
     
    453488                        <strong><?php echo $theme->display( 'Name' ); ?></strong>
    454489                        <?php
    455                         /* translators: 1: theme version, 2: new version */
    456490                        printf(
     491                                /* translators: 1: theme version, 2: new version */
    457492                                __( 'You have version %1$s installed. Update to %2$s.' ),
    458493                                $theme->display( 'Version' ),
     
    585620
    586621        show_message( __( 'WordPress updated successfully' ) );
    587         show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
    588         show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
     622        show_message(
     623                '<span class="hide-if-no-js">' . sprintf(
     624                        /* translators: 1: WordPress version, 2: URL to About screen */
     625                        __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ),
     626                        $result,
     627                        esc_url( self_admin_url( 'about.php?updated' ) )
     628                ) . '</span>'
     629        );
     630        show_message(
     631                '<span class="hide-if-js">' . sprintf(
     632                        /* translators: 1: WordPress version, 2: URL to About screen */
     633                        __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ),
     634                        $result,
     635                        esc_url( self_admin_url( 'about.php?updated' ) )
     636                ) . '</span>'
     637        );
    589638        ?>
    590639        </div>
Note: See TracChangeset for help on using the changeset viewer.