translate

Retrieve the translation of $text.

Description

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

If there is no translation, or the domain isn't loaded the original text is returned.

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' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-l10n.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($text, $domain); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-l10n.php  
  1. function translate( $text, $domain = 'default' ) { 
  2. $translations = &get_translations_for_domain( $domain ); 
  3. return apply_filters('gettext', $translations->translate($text), $text, $domain);