Upgrade/Install: Fix JavaScript localization on install page.
Blocks registration causes scripts to be initialized and localized very early, before the current locale has been properly set on the installation page. This changes `determine_locale()` so that the locale chosen during installation is recognized and loaded earlier, ensuring proper script localization. Props sabernhardt, NekoJonez, jornp, costdev. Fixes #58696 Built from https://develop.svn.wordpress.org/trunk@57286 git-svn-id: http://core.svn.wordpress.org/trunk@56792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
50670cd102
commit
b713c5eb9c
|
@ -329,7 +329,7 @@ if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
|
|||
*/
|
||||
$language = '';
|
||||
if ( ! empty( $_REQUEST['language'] ) ) {
|
||||
$language = preg_replace( '/[^a-zA-Z0-9_]/', '', $_REQUEST['language'] );
|
||||
$language = sanitize_locale_name( $_REQUEST['language'] );
|
||||
} elseif ( isset( $GLOBALS['wp_local_package'] ) ) {
|
||||
$language = $GLOBALS['wp_local_package'];
|
||||
}
|
||||
|
|
|
@ -150,6 +150,15 @@ function determine_locale() {
|
|||
( isset( $_GET['_locale'] ) && 'user' === $_GET['_locale'] && wp_is_json_request() )
|
||||
) {
|
||||
$determined_locale = get_user_locale();
|
||||
} elseif (
|
||||
( ! empty( $_REQUEST['language'] ) || isset( $GLOBALS['wp_local_package'] ) )
|
||||
&& wp_installing()
|
||||
) {
|
||||
if ( ! empty( $_REQUEST['language'] ) ) {
|
||||
$determined_locale = sanitize_locale_name( $_REQUEST['language'] );
|
||||
} else {
|
||||
$determined_locale = $GLOBALS['wp_local_package'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! $determined_locale ) {
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.5-alpha-57285';
|
||||
$wp_version = '6.5-alpha-57286';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue