I18N: Make domain argument optional in wp_set_script_translations() / WP_Scripts::set_translations().

Props swissspidy.
Fixes #45489.

git-svn-id: https://develop.svn.wordpress.org/trunk@44395 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2019-01-04 21:11:01 +00:00
parent b9c3486f73
commit 8cf4e9ce6a
4 changed files with 24 additions and 22 deletions

View File

@@ -466,16 +466,16 @@ function wp_default_packages_scripts( &$scripts ) {
);
$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',
'api-fetch',
'blocks',
'block-library',
'components',
'edit-post',
'editor',
'format-library',
'keycodes',
'list-reusable-blocks',
'nux',
);
foreach ( $packages_dependencies as $package => $dependencies ) {
@@ -485,8 +485,8 @@ function wp_default_packages_scripts( &$scripts ) {
$scripts->add( $handle, $path, $dependencies, $version, 1 );
if ( isset( $package_translations[ $package ] ) ) {
$scripts->set_translations( $handle, $package_translations[ $package ] );
if ( in_array( $package, $package_translations, true ) ) {
$scripts->set_translations( $handle );
}
}
}