General: Clarify the deprecation messages in the `_deprecated_*()` functions family.

This makes the strings easier to translate and provides more details about what exactly is deprecated: a PHP function, a file name, or a WordPress hook.

The changes apply to:
* `_deprecated_function()`
* `_deprecated_constructor()`
* `_deprecated_file()`
* `_deprecated_argument()`
* `_deprecated_hook()`
* `_doing_it_wrong()`

Follow-up to [6514], [7884], [12536], [12584], [16939], [16942], [16945], [24439], [24723], [32989], [37861], [39315].

Props mukesh27, audrasjb, SergeyBiryukov.
Fixes #54658.
Built from https://develop.svn.wordpress.org/trunk@52609


git-svn-id: http://core.svn.wordpress.org/trunk@52197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-01-20 13:13:01 +00:00
parent d4306e8d8a
commit e07b5af042
2 changed files with 21 additions and 21 deletions

View File

@ -5308,7 +5308,7 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */ /* translators: 1: PHP function name, 2: Version number, 3: Alternative function name. */
__( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ), __( 'Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$function, $function,
$version, $version,
$replacement $replacement
@ -5319,7 +5319,7 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: PHP function name, 2: Version number. */ /* translators: 1: PHP function name, 2: Version number. */
__( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ), __( 'Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$function, $function,
$version $version
), ),
@ -5330,7 +5330,7 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
if ( $replacement ) { if ( $replacement ) {
trigger_error( trigger_error(
sprintf( sprintf(
'%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', 'Function %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$function, $function,
$version, $version,
$replacement $replacement
@ -5340,7 +5340,7 @@ function _deprecated_function( $function, $version, $replacement = '' ) {
} else { } else {
trigger_error( trigger_error(
sprintf( sprintf(
'%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'Function %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
$function, $function,
$version $version
), ),
@ -5400,7 +5400,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: PHP class name, 2: PHP parent class name, 3: Version number, 4: __construct() method. */ /* translators: 1: PHP class name, 2: PHP parent class name, 3: Version number, 4: __construct() method. */
__( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ), __( 'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
$class, $class,
$parent_class, $parent_class,
$version, $version,
@ -5412,7 +5412,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: PHP class name, 2: Version number, 3: __construct() method. */ /* translators: 1: PHP class name, 2: Version number, 3: __construct() method. */
__( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ), __( 'The called constructor method for %1$s class is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$class, $class,
$version, $version,
'<code>__construct()</code>' '<code>__construct()</code>'
@ -5424,7 +5424,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
if ( $parent_class ) { if ( $parent_class ) {
trigger_error( trigger_error(
sprintf( sprintf(
'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.', 'The called constructor method for %1$s class in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
$class, $class,
$parent_class, $parent_class,
$version, $version,
@ -5435,7 +5435,7 @@ function _deprecated_constructor( $class, $version, $parent_class = '' ) {
} else { } else {
trigger_error( trigger_error(
sprintf( sprintf(
'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', 'The called constructor method for %1$s class is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$class, $class,
$version, $version,
'<code>__construct()</code>' '<code>__construct()</code>'
@ -5498,7 +5498,7 @@ function _deprecated_file( $file, $version, $replacement = '', $message = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: PHP file name, 2: Version number, 3: Alternative file name. */ /* translators: 1: PHP file name, 2: Version number, 3: Alternative file name. */
__( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ), __( 'File %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$file, $file,
$version, $version,
$replacement $replacement
@ -5509,7 +5509,7 @@ function _deprecated_file( $file, $version, $replacement = '', $message = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: PHP file name, 2: Version number. */ /* translators: 1: PHP file name, 2: Version number. */
__( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ), __( 'File %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$file, $file,
$version $version
) . $message, ) . $message,
@ -5520,7 +5520,7 @@ function _deprecated_file( $file, $version, $replacement = '', $message = '' ) {
if ( $replacement ) { if ( $replacement ) {
trigger_error( trigger_error(
sprintf( sprintf(
'%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', 'File %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
$file, $file,
$version, $version,
$replacement $replacement
@ -5530,7 +5530,7 @@ function _deprecated_file( $file, $version, $replacement = '', $message = '' ) {
} else { } else {
trigger_error( trigger_error(
sprintf( sprintf(
'%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', 'File %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
$file, $file,
$version $version
) . $message, ) . $message,
@ -5592,7 +5592,7 @@ function _deprecated_argument( $function, $version, $message = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: PHP function name, 2: Version number, 3: Optional message regarding the change. */ /* translators: 1: PHP function name, 2: Version number, 3: Optional message regarding the change. */
__( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s' ), __( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s' ),
$function, $function,
$version, $version,
$message $message
@ -5603,7 +5603,7 @@ function _deprecated_argument( $function, $version, $message = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: PHP function name, 2: Version number. */ /* translators: 1: PHP function name, 2: Version number. */
__( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.' ), __( 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$function, $function,
$version $version
), ),
@ -5614,7 +5614,7 @@ function _deprecated_argument( $function, $version, $message = '' ) {
if ( $message ) { if ( $message ) {
trigger_error( trigger_error(
sprintf( sprintf(
'%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s',
$function, $function,
$version, $version,
$message $message
@ -5624,7 +5624,7 @@ function _deprecated_argument( $function, $version, $message = '' ) {
} else { } else {
trigger_error( trigger_error(
sprintf( sprintf(
'%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', 'Function %1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.',
$function, $function,
$version $version
), ),
@ -5683,7 +5683,7 @@ function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */ /* translators: 1: WordPress hook name, 2: Version number, 3: Alternative hook name. */
__( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ), __( 'Hook %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
$hook, $hook,
$version, $version,
$replacement $replacement
@ -5694,7 +5694,7 @@ function _deprecated_hook( $hook, $version, $replacement = '', $message = '' ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: 1: WordPress hook name, 2: Version number. */ /* translators: 1: WordPress hook name, 2: Version number. */
__( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ), __( 'Hook %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
$hook, $hook,
$version $version
) . $message, ) . $message,
@ -5760,7 +5760,7 @@ function _doing_it_wrong( $function, $message, $version ) {
trigger_error( trigger_error(
sprintf( sprintf(
/* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */ /* translators: Developer debugging message. 1: PHP function name, 2: Explanatory message, 3: WordPress version number. */
__( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), __( 'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s' ),
$function, $function,
$message, $message,
$version $version
@ -5779,7 +5779,7 @@ function _doing_it_wrong( $function, $message, $version ) {
trigger_error( trigger_error(
sprintf( sprintf(
'%1$s was called <strong>incorrectly</strong>. %2$s %3$s', 'Function %1$s was called <strong>incorrectly</strong>. %2$s %3$s',
$function, $function,
$message, $message,
$version $version

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.0-alpha-52608'; $wp_version = '6.0-alpha-52609';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.