Making WordPress.org


Ignore:
Timestamp:
02/24/2017 11:10:13 PM (10 years ago)
Author:
ocean90
Message:

Plugin Directory: Fix two incorrect cases when trying to match a HTTP header to a WordPress locale.

Includes tests.

Props SergeyBiryukov.
Fixes #1850.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-locale-banner.php

    r4223 r5008  
    6969
    7070                // Build a list of WordPress locales which we'll suggest to the user.
    71                 $suggest_locales = array_values( array_intersect( $translated_locales, $locales_from_header ) );
     71                $suggest_locales = array_values( array_intersect( $locales_from_header, $translated_locales ) );
    7272                $current_locale_is_suggested = in_array( $current_locale, $suggest_locales );
    7373                $current_locale_is_translated = in_array( $current_locale, $translated_locales );
     
    263263
    264264                foreach ( $available_locales as $locale ) {
    265                         list( $lang, ) = preg_split( '/[_-]/', $locale );
    266                         if ( $lang ) {
     265                        list( $locale_lang, ) = preg_split( '/[_-]/', $locale );
     266                        if ( $lang === $locale_lang ) {
    267267                                return $locale;
    268268                        }
Note: See TracChangeset for help on using the changeset viewer.