Initializes the locale switcher.


(string) apply_filters( 'locale', (unknown) $locale ); 

If the locale is set, then it will filter the locale in the locale filter hook and return the value.

If the locale is not set already, then the BB_LANG constant is used if it is defined. Then it is filtered through the locale filter hook and the value for the locale global set and the locale is returned.

The process to get the locale should only be done once but the locale will always be filtered using the locale hook.

Returns (string)

The locale of the blog or from the 'locale' hook.

Parameters (1)

0. $locale (unknown)
The locale.


To run the hook, copy the example below.
  1. $locale = apply_filters( 'locale', $locale ); 
  3. if ( !empty( $locale ) ) { 
  5. // everything has led up to this point... 
The following example is for adding a hook callback.
  1. // define the locale callback 
  2. function filter_locale( $locale ) { 
  3. // make filter magic happen here... 
  4. return $locale
  5. }; 
  7. // add the filter 
  8. add_filter( 'locale', 'filter_locale', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'locale', 'filter_locale', 10, 1 ); 

Defined (2)

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

  1. return apply_filters( 'locale', $locale ); 
  1. return apply_filters( 'locale', $locale );