bb_load_plugin_textdomain

Loads the plugin's translated strings.

Description

bb_load_plugin_textdomain( (string) $domain, (constant) $path = false ); 

If the path is not given then it will be the root of the plugin directory. The .mo file should be named based on the domain with a dash followed by a dash, and then the locale exactly.

Parameters (2)

0. $domain (string)
Unique identifier for retrieving translated strings
1. $path — Optional. (constant) => false
Absolute path to folder where the .mo file resides

Usage

  1. if ( !function_exists( 'bb_load_plugin_textdomain' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-l10n.php'; 
  3.  
  4. // Unique identifier for retrieving translated strings 
  5. $domain = ''; 
  6.  
  7. // Optional. Absolute path to folder where the .mo file resides 
  8. $path = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_load_plugin_textdomain($domain, $path); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-l10n.php  
  1. function bb_load_plugin_textdomain($domain, $path = false) { 
  2. $locale = bb_get_locale(); 
  3.  
  4. if ( false === $path ) { 
  5. global $bb; 
  6. $path = $bb->plugin_locations['core']['dir']; 
  7.  
  8. $mofile = rtrim( trim( $path ), " \t\n\r\0\x0B/" ) . '/'. $domain . '-' . $locale . '.mo'; 
  9. load_textdomain($domain, $mofile);