Make WordPress Core

Ticket #45161: 45161.diff

File 45161.diff, 1.3 KB (added by herregroen, 6 years ago)
  • src/wp-includes/script-loader.php

     
    321321                'html-entities' => array( 'wp-polyfill' ),
    322322                'i18n' => array( 'wp-polyfill' ),
    323323                'is-shallow-equal' => array( 'wp-polyfill' ),
    324                 'keycodes' => array( 'lodash', 'wp-polyfill' ),
     324                'keycodes' => array( 'lodash', 'wp-polyfill', 'wp-i18n' ),
    325325                'list-reusable-blocks' => array(
    326326                        'lodash',
    327327                        'wp-api-fetch',
     
    363363                'wordcount' => array( 'wp-polyfill' ),
    364364        );
    365365
     366        $package_translations = array(
     367                'api-fetch' => 'default',
     368                'blocks' => 'default',
     369                'block-library' => 'default',
     370                'components' => 'default',
     371                'edit-post' => 'default',
     372                'editor' => 'default',
     373                'format-library' => 'default',
     374                'keycodes' => 'default',
     375                'list-reusable-blocks' => 'default',
     376                'nux' => 'default',
     377        );
     378
    366379        foreach ( $packages_dependencies as $package => $dependencies ) {
    367380                $handle  = 'wp-' . $package;
    368381                $path    = "/wp-includes/js/dist/$package$suffix.js";
    369382
    370383                $scripts->add( $handle, $path, $dependencies, false, 1 );
     384
     385                if ( array_key_exists( $package, $package_translations ) ) {
     386                        $scripts->set_translations( $handle, $package_translations[ $package ] );
     387                }
    371388        }
    372389}
    373390