From cf220df2b75d456a5cde0ede6cdbd727eb41698c Mon Sep 17 00:00:00 2001 From: "Dominik Schilling (ocean90)" Date: Mon, 14 Nov 2016 21:06:22 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@39230 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/l10n.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/l10n.php b/src/wp-includes/l10n.php index 39346c4d0d..1827166b14 100644 --- a/src/wp-includes/l10n.php +++ b/src/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 ); } } }