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/wp-db.php

    r45707 r45926  
    13081308        if ( strpos( $query, '%' ) === false ) {
    13091309            wp_load_translations_early();
    1310             _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9.0' );
     1310            _doing_it_wrong(
     1311                'wpdb::prepare',
     1312                sprintf(
     1313                    /* translators: %s: wpdb::prepare() */
     1314                    __( 'The query argument of %s must have a placeholder.' ),
     1315                    'wpdb::prepare()'
     1316                ),
     1317                '3.9.0'
     1318            );
    13111319        }
    13121320
     
    13211329            if ( ! is_scalar( $arg ) && ! is_null( $arg ) ) {
    13221330                wp_load_translations_early();
    1323                 _doing_it_wrong( 'wpdb::prepare', sprintf( __( 'Unsupported value type (%s).' ), gettype( $arg ) ), '4.8.2' );
     1331                _doing_it_wrong(
     1332                    'wpdb::prepare',
     1333                    sprintf(
     1334                        /* translators: %s: value type */
     1335                        __( 'Unsupported value type (%s).' ),
     1336                        gettype( $arg )
     1337                    ),
     1338                    '4.8.2'
     1339                );
    13241340            }
    13251341        }
     
    13581374                // If the passed query only expected one argument, but the wrong number of arguments were sent as an array, bail.
    13591375                wp_load_translations_early();
    1360                 _doing_it_wrong( 'wpdb::prepare', __( 'The query only expected one placeholder, but an array of multiple placeholders was sent.' ), '4.9.0' );
     1376                _doing_it_wrong(
     1377                    'wpdb::prepare',
     1378                    __( 'The query only expected one placeholder, but an array of multiple placeholders was sent.' ),
     1379                    '4.9.0'
     1380                );
    13611381
    13621382                return;
     
    13691389                _doing_it_wrong(
    13701390                    'wpdb::prepare',
    1371                     /* translators: 1: number of placeholders, 2: number of arguments passed */
    13721391                    sprintf(
     1392                        /* translators: 1: number of placeholders, 2: number of arguments passed */
    13731393                        __( 'The query does not contain the correct number of placeholders (%1$d) for the number of arguments passed (%2$d).' ),
    13741394                        $placeholders,
Note: See TracChangeset for help on using the changeset viewer.