Make WordPress Core


Ignore:
Timestamp:
01/04/2019 09:11:01 PM (7 years ago)
Author:
ocean90
Message:

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

Props swissspidy.
Fixes #45489.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r44391 r44395  
    467467
    468468    $package_translations = array(
    469         'api-fetch'            => 'default',
    470         'blocks'               => 'default',
    471         'block-library'        => 'default',
    472         'components'           => 'default',
    473         'edit-post'            => 'default',
    474         'editor'               => 'default',
    475         'format-library'       => 'default',
    476         'keycodes'             => 'default',
    477         'list-reusable-blocks' => 'default',
    478         'nux'                  => 'default',
     469        'api-fetch',
     470        'blocks',
     471        'block-library',
     472        'components',
     473        'edit-post',
     474        'editor',
     475        'format-library',
     476        'keycodes',
     477        'list-reusable-blocks',
     478        'nux',
    479479    );
    480480
     
    486486        $scripts->add( $handle, $path, $dependencies, $version, 1 );
    487487
    488         if ( isset( $package_translations[ $package ] ) ) {
    489             $scripts->set_translations( $handle, $package_translations[ $package ] );
     488        if ( in_array( $package, $package_translations, true ) ) {
     489            $scripts->set_translations( $handle );
    490490        }
    491491    }
Note: See TracChangeset for help on using the changeset viewer.