get_locale

Definition:
function get_locale() {}

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

Return values

returns:The locale of the blog or from the ‘locale’ hook.

Defined filters

  • locale
    apply_filters( 'locale', $locale )
  • locale
    apply_filters( 'locale', $locale )

Source code

function get_locale() {

	global $locale;



	if ( isset( $locale ) )

		return apply_filters( 'locale', $locale );



	// WPLANG is defined in wp-config.

	if ( defined( 'WPLANG' ) )

		$locale = WPLANG;



	// If multisite, check options.

	if ( is_multisite() ) {

		// Don't check blog option when installing.

		if ( defined( 'WP_INSTALLING' ) || ( false === $ms_locale = get_option( 'WPLANG' ) ) )

			$ms_locale = get_site_option('WPLANG');



		if ( $ms_locale !== false )

			$locale = $ms_locale;

	}



	if ( empty( $locale ) )

		$locale = 'en_US';



	return apply_filters( 'locale', $locale );

}

1472

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: