I18N: Always pass `$locale` to `load_textdomain()`.
In [53874] the optional `$locale` parameter was added to `load_textdomain()`. While most `load_textdomain()` calls in core were were updated, some were missed. Passing the original locale avoids the need to call `determine_locale()` by `load_textdomain()` which is used as a fallback. Props ocean90, swissspidy, desrosj. See #57060. Built from https://develop.svn.wordpress.org/trunk@54797 git-svn-id: http://core.svn.wordpress.org/trunk@54349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c64cc7959e
commit
c9a4d274fc
|
@ -13,7 +13,9 @@ if ( ! defined( 'WP_ADMIN' ) ) {
|
||||||
* some setup was skipped. Make sure the admin message catalog is loaded since
|
* some setup was skipped. Make sure the admin message catalog is loaded since
|
||||||
* load_default_textdomain() will not have done so in this context.
|
* load_default_textdomain() will not have done so in this context.
|
||||||
*/
|
*/
|
||||||
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . get_locale() . '.mo' );
|
$admin_locale = get_locale();
|
||||||
|
load_textdomain( 'default', WP_LANG_DIR . '/admin-' . $admin_locale . '.mo', $admin_locale );
|
||||||
|
unset( $admin_locale );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** WordPress Administration Hooks */
|
/** WordPress Administration Hooks */
|
||||||
|
|
|
@ -6351,7 +6351,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) {
|
||||||
$locale_loaded = $locale ? $locale : get_locale();
|
$locale_loaded = $locale ? $locale : get_locale();
|
||||||
$mofile = WP_LANG_DIR . '/continents-cities-' . $locale_loaded . '.mo';
|
$mofile = WP_LANG_DIR . '/continents-cities-' . $locale_loaded . '.mo';
|
||||||
unload_textdomain( 'continents-cities' );
|
unload_textdomain( 'continents-cities' );
|
||||||
load_textdomain( 'continents-cities', $mofile );
|
load_textdomain( 'continents-cities', $mofile, $locale_loaded );
|
||||||
$mo_loaded = true;
|
$mo_loaded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1392,9 +1392,9 @@ function wp_load_translations_early() {
|
||||||
foreach ( $locales as $locale ) {
|
foreach ( $locales as $locale ) {
|
||||||
foreach ( $locations as $location ) {
|
foreach ( $locations as $location ) {
|
||||||
if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
|
if ( file_exists( $location . '/' . $locale . '.mo' ) ) {
|
||||||
load_textdomain( 'default', $location . '/' . $locale . '.mo' );
|
load_textdomain( 'default', $location . '/' . $locale . '.mo', $locale );
|
||||||
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) ) {
|
if ( defined( 'WP_SETUP_CONFIG' ) && file_exists( $location . '/admin-' . $locale . '.mo' ) ) {
|
||||||
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo' );
|
load_textdomain( 'default', $location . '/admin-' . $locale . '.mo', $locale );
|
||||||
}
|
}
|
||||||
break 2;
|
break 2;
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,7 +336,7 @@ class WP_REST_Site_Health_Controller extends WP_REST_Controller {
|
||||||
// Accounts for inner REST API requests in the admin.
|
// Accounts for inner REST API requests in the admin.
|
||||||
if ( ! is_admin() ) {
|
if ( ! is_admin() ) {
|
||||||
$locale = determine_locale();
|
$locale = determine_locale();
|
||||||
load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo" );
|
load_textdomain( 'default', WP_LANG_DIR . "/admin-$locale.mo", $locale );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.2-alpha-54794';
|
$wp_version = '6.2-alpha-54797';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue