Make WordPress Core

Changeset 42252


Ignore:
Timestamp:
11/28/2017 02:53:29 PM (7 years ago)
Author:
johnbillion
Message:

Media: Further improvements to the handling of language codes that get passed to MediaElement.

This change means that only the leading portion of a locale code gets passed to MediaElement, removing problems that arise from locales such as de_DE_formal and pt_PT_ao90.

Props erich_k4wp, blobfolio, flixos90, ocean90, joemcgill, SergeyBiryukov.

Fixes #42574

Merges [42251] to the 4.9 branch.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/script-loader.php

    r42164 r42252  
    358358
    359359    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() ) ),
     360        'language' => strtolower( strtok( is_admin() ? get_user_locale() : get_locale(), '_-' ) ),
    361361        'strings'  => array(
    362362            '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/' ),
Note: See TracChangeset for help on using the changeset viewer.