wpcf7_is_valid_locale

The Contact Form 7 wpcf7 is valid locale function.

Description

wpcf7_is_valid_locale( $locale ); 

Parameters (1)

0. $locale
The locale.

Usage

  1. if ( !function_exists( 'wpcf7_is_valid_locale' ) ) { 
  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_is_valid_locale($locale); 
  9.  

Defined (1)

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

/includes/l10n.php  
  1. function wpcf7_is_valid_locale( $locale ) { 
  2. $pattern = '/^[a-z]{2, 3}(?:_[a-zA-Z_]{2, })?$/'; 
  3. return (bool) preg_match( $pattern, $locale );