get_locale [ WordPress Function ]
| Uses: |
|
| Returns: |
|
| Defined at: |
|
Gets the current 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 WPLANG 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.
Source
<?php
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 );
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/get locale « WordPress Codex
Description. Gets the current 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 ...
codex.wordpress.org - i18n::get_locale() and $this->Locale return different values ...
I have implemented a site with several languages just as described in the tutorial. But when trying to display text using the _t() function it always ...
www.silverstripe.org - get_locale | A HitchHackers guide through WordPress
Feb 12, 2011 ... function get_locale() { global $locale; if ( isset( $locale ) ) return apply_filters( ' locale', $locale ); // WPLANG is defined in wp-config. if ( defined( ...
hitchhackerguide.com - Sketchup - Google SketchUp Ruby API — Google Developers
get_datfile_info; get_i18ndatfile_info; get_locale; get_resource_path .... The get_locale method returns the language code for the language SketchUp is running ...
developers.google.com