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

    r45881 r45926  
    210210function core_update_footer( $msg = '' ) {
    211211    if ( ! current_user_can( 'update_core' ) ) {
     212        /* translators: %s: WordPress version */
    212213        return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
    213214    }
     
    232233    switch ( $cur->response ) {
    233234        case 'development':
    234             /* translators: 1: WordPress version number, 2: WordPress updates admin screen URL */
    235             return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) );
     235            return sprintf(
     236                /* translators: 1: WordPress version number, 2: WordPress updates admin screen URL */
     237                __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ),
     238                get_bloginfo( 'version', 'display' ),
     239                network_admin_url( 'update-core.php' )
     240            );
    236241
    237242        case 'upgrade':
    238             return '<strong><a href="' . network_admin_url( 'update-core.php' ) . '">' . sprintf( __( 'Get Version %s' ), $cur->current ) . '</a></strong>';
     243            return sprintf(
     244                '<strong><a href="%s">%s</a></strong>',
     245                network_admin_url( 'update-core.php' ),
     246                /* translators: %s: WordPress version */
     247                sprintf( __( 'Get Version %s' ), $cur->current )
     248            );
    239249
    240250        case 'latest':
    241251        default:
     252            /* translators: %s: WordPress version */
    242253            return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
    243254    }
     
    304315
    305316        if ( isset( $cur->response ) && $cur->response == 'upgrade' ) {
    306             $msg .= '<a href="' . network_admin_url( 'update-core.php' ) . '" class="button" aria-describedby="wp-version">' . sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a> ';
     317            $msg .= sprintf(
     318                '<a href="%s" class="button" aria-describedby="wp-version">%s</a> ',
     319                network_admin_url( 'update-core.php' ),
     320                /* translators: %s: WordPress version number, or 'Latest' string */
     321                sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) )
     322            );
    307323        }
    308324    }
     
    407423        $notice_type    = $compatible_php ? 'notice-warning' : 'notice-error';
    408424
    409         echo '<tr class="plugin-update-tr' . $active_class . '" id="' . esc_attr( $response->slug . '-update' ) . '" data-slug="' . esc_attr( $response->slug ) . '" data-plugin="' . esc_attr( $file ) . '"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message notice inline ' . $notice_type . ' notice-alt"><p>';
     425        printf(
     426            '<tr class="plugin-update-tr%s" id="%s" data-slug="%s" data-plugin="%s">' .
     427            '<td colspan="%s" class="plugin-update colspanchange">' .
     428            '<div class="update-message notice inline %s notice-alt"><p>',
     429            $active_class,
     430            esc_attr( $response->slug . '-update' ),
     431            esc_attr( $response->slug ),
     432            esc_attr( $file ),
     433            esc_attr( $wp_list_table->get_column_count() ),
     434            $notice_type
     435        );
    410436
    411437        if ( ! current_user_can( 'update_plugins' ) ) {
    412             /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number */
    413438            printf(
     439                /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number */
    414440                __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ),
    415441                $plugin_name,
     
    423449            );
    424450        } elseif ( empty( $response->package ) ) {
    425             /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number */
    426451            printf(
     452                /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number */
    427453                __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>' ),
    428454                $plugin_name,
     
    437463        } else {
    438464            if ( $compatible_php ) {
    439                 /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number, 5: update URL, 6: additional link attributes */
    440465                printf(
     466                    /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number, 5: update URL, 6: additional link attributes */
    441467                    __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ),
    442468                    $plugin_name,
     
    456482                );
    457483            } else {
    458                 /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number 5: Update PHP page URL */
    459484                printf(
     485                    /* translators: 1: plugin name, 2: details URL, 3: additional link attributes, 4: version number 5: Update PHP page URL */
    460486                    __( 'There is a new version of %1$s available, but it doesn&#8217;t work with your version of PHP. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s">learn more about updating PHP</a>.' ),
    461487                    $plugin_name,
     
    581607    $active = $theme->is_allowed( 'network' ) ? ' active' : '';
    582608
    583     echo '<tr class="plugin-update-tr' . $active . '" id="' . esc_attr( $theme->get_stylesheet() . '-update' ) . '" data-slug="' . esc_attr( $theme->get_stylesheet() ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message notice inline notice-warning notice-alt"><p>';
     609    printf(
     610        '<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' .
     611        '<td colspan="%s" class="plugin-update colspanchange">' .
     612        '<div class="update-message notice inline notice-warning notice-alt"><p>',
     613        $active,
     614        esc_attr( $theme->get_stylesheet() . '-update' ),
     615        esc_attr( $theme->get_stylesheet() ),
     616        $wp_list_table->get_column_count()
     617    );
     618
    584619    if ( ! current_user_can( 'update_themes' ) ) {
    585         /* translators: 1: theme name, 2: details URL, 3: additional link attributes, 4: version number */
    586620        printf(
     621            /* translators: 1: theme name, 2: details URL, 3: additional link attributes, 4: version number */
    587622            __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ),
    588623            $theme['Name'],
     
    596631        );
    597632    } elseif ( empty( $response['package'] ) ) {
    598         /* translators: 1: theme name, 2: details URL, 3: additional link attributes, 4: version number */
    599633        printf(
     634            /* translators: 1: theme name, 2: details URL, 3: additional link attributes, 4: version number */
    600635            __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ),
    601636            $theme['Name'],
     
    609644        );
    610645    } else {
    611         /* translators: 1: theme name, 2: details URL, 3: additional link attributes, 4: version number, 5: update URL, 6: additional link attributes */
    612646        printf(
     647            /* translators: 1: theme name, 2: details URL, 3: additional link attributes, 4: version number, 5: update URL, 6: additional link attributes */
    613648            __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ),
    614649            $theme['Name'],
     
    683718
    684719    if ( current_user_can( 'update_core' ) ) {
    685         $msg = sprintf( __( 'An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.' ), 'update-core.php' );
     720        $msg = sprintf(
     721            /* translators: %s: URL to WordPress Updates screen */
     722            __( 'An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.' ),
     723            'update-core.php'
     724        );
    686725    } else {
    687726        $msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' );
Note: See TracChangeset for help on using the changeset viewer.