WordPress.org

Make WordPress Core

Changeset 39230


Ignore:
Timestamp:
11/14/2016 09:06:22 PM (5 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/l10n.php

    r39169 r39230  
    860860
    861861        foreach ( $locations as $location ) {
    862             foreach ( get_available_languages( $location ) as $file ) {
    863                 $cached_mofiles[] = "{$location}/{$file}.mo";
     862            $mofiles = glob( $location . '/*.mo' );
     863            if ( $mofiles ) {
     864                $cached_mofiles = array_merge( $cached_mofiles, $mofiles );
    864865            }
    865866        }
Note: See TracChangeset for help on using the changeset viewer.