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
This commit is contained in:
Dominik Schilling (ocean90) 2016-11-14 21:06:22 +00:00
parent 58d01ff805
commit cf220df2b7

View File

@ -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 );
}
}
}