Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_locale [ WordPress Function ]

get_locale ( No parameters )
Uses:
Returns:
  • (string) The locale of the blog or from the 'locale' hook.
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 ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics