wpcf7_load_textdomain

The Contact Form 7 wpcf7 load textdomain function.

Description

wpcf7_load_textdomain( (null) $locale = null ); 

Parameters (1)

0. $locale — Optional. (null) => null
The locale.

Usage

  1. if ( !function_exists( 'wpcf7_load_textdomain' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/includes/l10n.php'; 
  3.  
  4. // The locale. 
  5. $locale = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wpcf7_load_textdomain($locale); 
  9.  

Defined (1)

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

/includes/l10n.php  
  1. function wpcf7_load_textdomain( $locale = null ) { 
  2. global $l10n; 
  3.  
  4. $domain = 'contact-form-7'; 
  5.  
  6. if ( get_locale() == $locale ) { 
  7. $locale = null; 
  8.  
  9. if ( empty( $locale ) ) { 
  10. if ( is_textdomain_loaded( $domain ) ) { 
  11. return true; 
  12. } else { 
  13. return load_plugin_textdomain( $domain, false, $domain . '/languages' ); 
  14. } else { 
  15. $mo_orig = $l10n[$domain]; 
  16. unload_textdomain( $domain ); 
  17.  
  18. $mofile = $domain . '-' . $locale . '.mo'; 
  19. $path = WP_PLUGIN_DIR . '/' . $domain . '/languages'; 
  20.  
  21. if ( $loaded = load_textdomain( $domain, $path . '/'. $mofile ) ) { 
  22. return $loaded; 
  23. } else { 
  24. $mofile = WP_LANG_DIR . '/plugins/' . $mofile; 
  25. return load_textdomain( $domain, $mofile ); 
  26.  
  27. $l10n[$domain] = $mo_orig; 
  28.  
  29. return false;