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-includes/widgets.php

    r45798 r45926  
    176176
    177177        if ( $number > 1 ) {
    178             $_args['name'] = isset( $args['name'] ) ? sprintf( $args['name'], $i ) : sprintf( __( 'Sidebar %d' ), $i );
     178            if ( isset( $args['name'] ) ) {
     179                $_args['name'] = sprintf( $args['name'], $i );
     180            } else {
     181                /* translators: %d: Sidebar number */
     182                $_args['name'] = sprintf( __( 'Sidebar %d' ), $i );
     183            }
    179184        } else {
    180185            $_args['name'] = isset( $args['name'] ) ? $args['name'] : __( 'Sidebar' );
     
    248253
    249254    $defaults = array(
     255        /* translators: %d: Sidebar number */
    250256        'name'          => sprintf( __( 'Sidebar %d' ), $i ),
    251257        'id'            => "sidebar-$i",
     
    261267
    262268    if ( $id_is_empty ) {
    263         /* translators: 1: the id argument, 2: sidebar name, 3: recommended id value */
    264         _doing_it_wrong( __FUNCTION__, sprintf( __( 'No %1$s was set in the arguments array for the "%2$s" sidebar. Defaulting to "%3$s". Manually set the %1$s to "%3$s" to silence this notice and keep existing sidebar content.' ), '<code>id</code>', $sidebar['name'], $sidebar['id'] ), '4.2.0' );
     269        _doing_it_wrong(
     270            __FUNCTION__,
     271            sprintf(
     272                /* translators: 1: the id argument, 2: sidebar name, 3: recommended id value */
     273                __( 'No %1$s was set in the arguments array for the "%2$s" sidebar. Defaulting to "%3$s". Manually set the %1$s to "%3$s" to silence this notice and keep existing sidebar content.' ),
     274                '<code>id</code>',
     275                $sidebar['name'],
     276                $sidebar['id']
     277            ),
     278            '4.2.0'
     279        );
    265280    }
    266281
     
    11051120
    11061121    if ( ! isset( $wp_widget_factory->widgets[ $widget ] ) ) {
    1107         /* translators: %s: register_widget() */
    1108         _doing_it_wrong( __FUNCTION__, sprintf( __( 'Widgets need to be registered using %s, before they can be displayed.' ), '<code>register_widget()</code>' ), '4.9.0' );
     1122        _doing_it_wrong(
     1123            __FUNCTION__,
     1124            sprintf(
     1125                /* translators: %s: register_widget() */
     1126                __( 'Widgets need to be registered using %s, before they can be displayed.' ),
     1127                '<code>register_widget()</code>'
     1128            ),
     1129            '4.9.0'
     1130        );
    11091131        return;
    11101132    }
Note: See TracChangeset for help on using the changeset viewer.