mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@45926 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1307,7 +1307,15 @@ class wpdb {
|
||||
// This is not meant to be foolproof -- but it will catch obviously incorrect usage.
|
||||
if ( strpos( $query, '%' ) === false ) {
|
||||
wp_load_translations_early();
|
||||
_doing_it_wrong( 'wpdb::prepare', sprintf( __( 'The query argument of %s must have a placeholder.' ), 'wpdb::prepare()' ), '3.9.0' );
|
||||
_doing_it_wrong(
|
||||
'wpdb::prepare',
|
||||
sprintf(
|
||||
/* translators: %s: wpdb::prepare() */
|
||||
__( 'The query argument of %s must have a placeholder.' ),
|
||||
'wpdb::prepare()'
|
||||
),
|
||||
'3.9.0'
|
||||
);
|
||||
}
|
||||
|
||||
// If args were passed as an array (as in vsprintf), move them up.
|
||||
@@ -1320,7 +1328,15 @@ class wpdb {
|
||||
foreach ( $args as $arg ) {
|
||||
if ( ! is_scalar( $arg ) && ! is_null( $arg ) ) {
|
||||
wp_load_translations_early();
|
||||
_doing_it_wrong( 'wpdb::prepare', sprintf( __( 'Unsupported value type (%s).' ), gettype( $arg ) ), '4.8.2' );
|
||||
_doing_it_wrong(
|
||||
'wpdb::prepare',
|
||||
sprintf(
|
||||
/* translators: %s: value type */
|
||||
__( 'Unsupported value type (%s).' ),
|
||||
gettype( $arg )
|
||||
),
|
||||
'4.8.2'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1357,7 +1373,11 @@ class wpdb {
|
||||
if ( 1 === $placeholders && $passed_as_array ) {
|
||||
// If the passed query only expected one argument, but the wrong number of arguments were sent as an array, bail.
|
||||
wp_load_translations_early();
|
||||
_doing_it_wrong( 'wpdb::prepare', __( 'The query only expected one placeholder, but an array of multiple placeholders was sent.' ), '4.9.0' );
|
||||
_doing_it_wrong(
|
||||
'wpdb::prepare',
|
||||
__( 'The query only expected one placeholder, but an array of multiple placeholders was sent.' ),
|
||||
'4.9.0'
|
||||
);
|
||||
|
||||
return;
|
||||
} else {
|
||||
@@ -1368,8 +1388,8 @@ class wpdb {
|
||||
wp_load_translations_early();
|
||||
_doing_it_wrong(
|
||||
'wpdb::prepare',
|
||||
/* translators: 1: number of placeholders, 2: number of arguments passed */
|
||||
sprintf(
|
||||
/* translators: 1: number of placeholders, 2: number of arguments passed */
|
||||
__( 'The query does not contain the correct number of placeholders (%1$d) for the number of arguments passed (%2$d).' ),
|
||||
$placeholders,
|
||||
count( $args )
|
||||
|
||||
Reference in New Issue
Block a user