Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: locale

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
23  * @uses apply_filters() Calls 'locale' hook on locale value.
24  * @uses $locale Gets the locale stored in the global.
25  *
26  * @return string The locale of the blog or from the 'locale' hook.
27  */
28 function get_locale() {
29      global $locale;
30
31      if ( isset( $locale ) )
32           return apply_filters( 'locale', $locale );
33
34      // WPLANG is defined in wp-config.
35      if ( defined( 'WPLANG' ) )
36           $locale = WPLANG;
37
38      // If multisite, check options.
39      if ( is_multisite() && !defined('WP_INSTALLING') ) {
40           $ms_locale = get_option('WPLANG');
41           if ( $ms_locale === false )
42                $ms_locale = get_site_option('WPLANG');
43
44           if ( $ms_locale !== false )
45                $locale = $ms_locale;
46      }
47
48      if ( empty( $locale ) )
49           $locale = 'en_US';
50
51      return apply_filters( 'locale', $locale );
52 }
53
54 /**
55  * Retrieves the translation of $text. If there is no translation, or
56  * the domain isn't loaded the original text is returned.
57  *
58  * @see __() Don't use translate() directly, use __()
59  * @since 2.2.0
60  * @uses apply_filters() Calls 'gettext' on domain translated text