WordPress.org

Make WordPress Core

Ticket #42574: 42574.3.diff

File 42574.3.diff, 1.5 KB (added by ocean90, 6 months ago)
  • src/wp-includes/script-loader.php

     
    356356        $scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.6-78496d1', 1 );
    357357        $scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1);
    358358
     359        /*
     360         * translators: Translate this to a language tag supported by MediaElement.js.
     361         * Do not translate into your own language.
     362         */
     363        $mejs_language = __( 'mejs_language' );
     364        if ( 'mejs_language' === $output || preg_match( '/[^a-z-]/', $output ) ) {
     365                $mejs_language = is_admin() ? get_user_locale() : get_locale();
     366                $mejs_language = strtolower( strtok( $mejs_language ), '_' ); // Use only the first part for compatibility.
     367        }
     368
    359369        did_action( 'init' ) && $scripts->add_inline_script( 'mediaelement-core', sprintf( 'var mejsL10n = %s;', wp_json_encode( array(
    360                 'language' => strtolower( str_replace( '_', '-', is_admin() ? get_user_locale() : get_locale() ) ),
     370                'language' => $mejs_language,
    361371                'strings'  => array(
    362372                        'mejs.install-flash'       => __( 'You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/' ),
    363373                        'mejs.fullscreen-off'      => __( 'Turn off Fullscreen' ),