Yap, got the answer from toscho's Answer from a WPSE thread. Simply quoting him, but made a little change as I got a Fatal Error directly using his code into my theme's functions.php
:
Fatal error: Cannot redeclare get_locale()
Using simply get_locale()
as a function name was causing the problem. So with love and respect to toscho, I changed his function name from get_locale()
to toscho_get_locale()
. Now it's working.
So, just paste them into your theme's functions.php
:
function toscho_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 );
}
Using the Filter:Locale, hook your function:
add_filter( 'locale', 'wpse_52419_toscho_change_language' );
function wpse_52419_toscho_change_language( $locale ) {
return 'bn_BD';
}
Place the code into your functions.php
.