wcde_is_german

Helper function to determine if in a German locale based environment.

Description

wcde_is_german(); 

Usage

  1. if ( !function_exists( 'wcde_is_german' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'woocommerce-german-de_de/includes/wcde-functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wcde_is_german(); 
  7.  

Defined (1)

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

/includes/wcde-functions.php  
  1. function wcde_is_german() { 
  2.  
  3. /** Set array of German-based locale codes */ 
  4. $german_locales = array( 'de_DE', 'de_AT', 'de_CH', 'de_LU', 'gsw' ); 
  5.  
  6. /** Get possible WPLANG option values */ 
  7. $option_wplang = get_option( 'WPLANG' ); 
  8. $site_option_wplang = get_site_option( 'WPLANG' ); 
  9.  
  10. /** 
  11. * Check for German-based environment/ context in locale/ WPLANG setting 
  12. * and/ or within WPML (premium plugin). 
  13. * NOTE: This is very important for multilingual sites and/or Multisite 
  14. * installs. 
  15. */ 
  16. if ( ( in_array( get_locale(), $german_locales ) 
  17. || ( $option_wplang && in_array( $option_wplang, $german_locales ) ) 
  18. || ( $site_option_wplang && in_array( $site_option_wplang, $german_locales ) ) 
  19. || ( defined( 'ICL_LANGUAGE_CODE' ) && ( 'de' === ICL_LANGUAGE_CODE ) ) 
  20. ) { 
  21.  
  22. /** Yes, we are in German-based environmet */ 
  23. return TRUE; 
  24.  
  25. } else { 
  26.  
  27. /** Non-German! */ 
  28. return FALSE; 
  29.  
  30. } // end if 
  31.  
  32. } // end of function wcde_is_german