From af52df0aa1dbbff91cfff5d91f060d16482e8374 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 28 Nov 2017 14:51:33 +0000 Subject: [PATCH] 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 git-svn-id: https://develop.svn.wordpress.org/trunk@42251 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/script-loader.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index cc401f6925..0202474f84 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -357,7 +357,7 @@ function wp_default_scripts( &$scripts ) { $scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1); did_action( 'init' ) && $scripts->add_inline_script( 'mediaelement-core', sprintf( 'var mejsL10n = %s;', wp_json_encode( array( - 'language' => strtolower( str_replace( '_', '-', is_admin() ? get_user_locale() : get_locale() ) ), + 'language' => strtolower( strtok( is_admin() ? get_user_locale() : get_locale(), '_-' ) ), 'strings' => array( '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/' ), 'mejs.fullscreen-off' => __( 'Turn off Fullscreen' ),