Make WordPress Core

Changeset 24723


Ignore:
Timestamp:
07/17/2013 09:04:50 PM (11 years ago)
Author:
westi
Message:

Fall back to non-translated strings in _deprecated_*() if the translation function doesn't exist. This may be the case in sunrise, for example.

Fixes #24778 props SergeyBiryukov.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.php

    r24695 r24723  
    28652865    // Allow plugin to filter the output error trigger
    28662866    if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
    2867         if ( ! is_null($replacement) )
    2868             trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
    2869         else
    2870             trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
     2867        if ( function_exists( '__' ) ) {
     2868            if ( ! is_null( $replacement ) )
     2869                trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
     2870            else
     2871                trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
     2872        } else {
     2873            if ( ! is_null( $replacement ) )
     2874                trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
     2875            else
     2876                trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
     2877        }
    28712878    }
    28722879}
     
    29052912    if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
    29062913        $message = empty( $message ) ? '' : ' ' . $message;
    2907         if ( ! is_null( $replacement ) )
    2908             trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
    2909         else
    2910             trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
     2914        if ( function_exists( '__' ) ) {
     2915            if ( ! is_null( $replacement ) )
     2916                trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
     2917            else
     2918                trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
     2919        } else {
     2920            if ( ! is_null( $replacement ) )
     2921                trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
     2922            else
     2923                trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
     2924        }
    29112925    }
    29122926}
     
    29492963    // Allow plugin to filter the output error trigger
    29502964    if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
    2951         if ( ! is_null( $message ) )
    2952             trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
    2953         else
    2954             trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
     2965        if ( function_exists( '__' ) ) {
     2966            if ( ! is_null( $message ) )
     2967                trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
     2968            else
     2969                trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
     2970        } else {
     2971            if ( ! is_null( $message ) )
     2972                trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
     2973            else
     2974                trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
     2975        }
    29552976    }
    29562977}
Note: See TracChangeset for help on using the changeset viewer.