From c3dc173799e8387d18bde9117a462dece6a628c3 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Mon, 14 Nov 2016 21:07:30 +0000 Subject: [PATCH] I18N: Don't use `get_available_languages()` in `_load_textdomain_just_in_time()`. `get_available_languages()` is only designed to work with translations for core. Using it for plugins/themes means unnecessary `strpos()` checks and incomplete results for plugins/themes whose names are beginning with `admin-` or `ms-`. Props swissspidy, ocean90. Fixes #38590. Built from https://develop.svn.wordpress.org/trunk@39230 git-svn-id: http://core.svn.wordpress.org/trunk@39170 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/l10n.php | 5 +++-- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/wp-includes/l10n.php b/wp-includes/l10n.php index 39346c4d0d..1827166b14 100644 --- a/wp-includes/l10n.php +++ b/wp-includes/l10n.php @@ -859,8 +859,9 @@ function _load_textdomain_just_in_time( $domain ) { ); foreach ( $locations as $location ) { - foreach ( get_available_languages( $location ) as $file ) { - $cached_mofiles[] = "{$location}/{$file}.mo"; + $mofiles = glob( $location . '/*.mo' ); + if ( $mofiles ) { + $cached_mofiles = array_merge( $cached_mofiles, $mofiles ); } } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 0fc0170f2c..06e8f27622 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7-beta3-39229'; +$wp_version = '4.7-beta3-39230'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.