Load locale specific php code in global context. fixes #3488
git-svn-id: https://develop.svn.wordpress.org/trunk@4699 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3abce30c6b
commit
ee3f4cde4e
@ -87,20 +87,12 @@ class WP_Locale {
|
|||||||
$this->meridiem['AM'] = __('AM');
|
$this->meridiem['AM'] = __('AM');
|
||||||
$this->meridiem['PM'] = __('PM');
|
$this->meridiem['PM'] = __('PM');
|
||||||
|
|
||||||
$this->_load_locale_data();
|
// Import global locale vars set during inclusion of $locale.php.
|
||||||
}
|
|
||||||
|
|
||||||
function _load_locale_data() {
|
|
||||||
$locale = get_locale();
|
|
||||||
$locale_file = ABSPATH . "wp-includes/languages/$locale.php";
|
|
||||||
if ( !file_exists($locale_file) )
|
|
||||||
return;
|
|
||||||
|
|
||||||
include($locale_file);
|
|
||||||
|
|
||||||
foreach ( $this->locale_vars as $var ) {
|
foreach ( $this->locale_vars as $var ) {
|
||||||
$this->$var = $$var;
|
if ( isset($GLOBALS[$var]) )
|
||||||
|
$this->$var = $GLOBALS[$var];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_weekday($weekday_number) {
|
function get_weekday($weekday_number) {
|
||||||
|
@ -242,6 +242,11 @@ define('STYLESHEETPATH', get_stylesheet_directory());
|
|||||||
// Load the default text localization domain.
|
// Load the default text localization domain.
|
||||||
load_default_textdomain();
|
load_default_textdomain();
|
||||||
|
|
||||||
|
$locale = get_locale();
|
||||||
|
$locale_file = ABSPATH . LANGDIR . "/$locale.php";
|
||||||
|
if ( is_readable($locale_file) )
|
||||||
|
require_once($locale_file);
|
||||||
|
|
||||||
// Pull in locale data after loading text domain.
|
// Pull in locale data after loading text domain.
|
||||||
require_once(ABSPATH . WPINC . '/locale.php');
|
require_once(ABSPATH . WPINC . '/locale.php');
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user