translate_with_context

Translates $text like translate(), but assumes that the text contains a context after its last vertical bar.

Description

(string) translate_with_context( (string) $text, (string) $domain = 'default' ); 

Returns (string)

Translated text

Parameters (2)

0. $text (string)
Text to translate
1. $domain — Optional. (string) => 'default'
Domain to retrieve the translated text

Usage

  1. if ( !function_exists( 'translate_with_context' ) ) { 
  2. require_once ABSPATH . WPINC . '/deprecated.php'; 
  3.  
  4. // Text to translate 
  5. $text = ''; 
  6.  
  7. // Domain to retrieve the translated text 
  8. $domain = 'default'; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = translate_with_context($text, $domain); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/deprecated.php  
  1. function translate_with_context( $text, $domain = 'default' ) { 
  2. _deprecated_function( __FUNCTION__, '2.9.0', '_x()' ); 
  3. return before_last_bar( translate( $text, $domain ) );