diff --git a/wp-includes/class.wp-scripts.php b/wp-includes/class.wp-scripts.php index 42374815d0..e843233cbc 100644 --- a/wp-includes/class.wp-scripts.php +++ b/wp-includes/class.wp-scripts.php @@ -546,7 +546,8 @@ class WP_Scripts extends WP_Dependencies { } $output = '(function( translations ){' . - 'wp.i18n.setLocaleData( translations.locale_data, "' . $domain . '" );' . + 'translations.locale_data.messages[""].domain = "' . $domain . '";' . + 'wp.i18n.setLocaleData( translations.locale_data.messages, "' . $domain . '" );' . '})(' . $json_translations . ');'; if ( $echo ) { diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 5699810ef4..6dd77f46b2 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -319,7 +319,7 @@ function wp_default_packages_scripts( &$scripts ) { 'html-entities' => array( 'wp-polyfill' ), 'i18n' => array( 'wp-polyfill' ), 'is-shallow-equal' => array( 'wp-polyfill' ), - 'keycodes' => array( 'lodash', 'wp-polyfill' ), + 'keycodes' => array( 'lodash', 'wp-polyfill', 'wp-i18n' ), 'list-reusable-blocks' => array( 'lodash', 'wp-api-fetch', @@ -361,11 +361,28 @@ function wp_default_packages_scripts( &$scripts ) { 'wordcount' => array( 'wp-polyfill' ), ); + $package_translations = array( + 'api-fetch' => 'default', + 'blocks' => 'default', + 'block-library' => 'default', + 'components' => 'default', + 'edit-post' => 'default', + 'editor' => 'default', + 'format-library' => 'default', + 'keycodes' => 'default', + 'list-reusable-blocks' => 'default', + 'nux' => 'default', + ); + foreach ( $packages_dependencies as $package => $dependencies ) { $handle = 'wp-' . $package; $path = "/wp-includes/js/dist/$package$suffix.js"; $scripts->add( $handle, $path, $dependencies, false, 1 ); + + if ( isset( $package_translations[ $package ] ) ) { + $scripts->set_translations( $handle, $package_translations[ $package ] ); + } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index cfefcead9f..ccd116e0d2 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.1-alpha-44238'; +$wp_version = '5.1-alpha-44239'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.