WordPress.org

Make WordPress Core

Changeset 41889


Ignore:
Timestamp:
10/18/2017 12:07:30 AM (23 months ago)
Author:
westonruter
Message:

Media: Use user locale as ME.js language in admin and add mejsL10n inline script before mediaelement-core so WP-exported translation strings are used.

See #39686.
Fixes #42241.

File:
1 edited

Legend:

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

    r41879 r41889  
    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);
    358     did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejsL10n', array(
    359         'language' => get_bloginfo( 'language' ),
     358
     359    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() ) ),
    360361        'strings'  => array(
    361362            '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/' ),
     
    444445            'mejs.yiddish'             => __( 'Yiddish' ),
    445446            ),
    446         ) );
     447        ) ) ), 'before' );
    447448
    448449
Note: See TracChangeset for help on using the changeset viewer.