WordPress.org

Making WordPress.org

Changeset 3491


Ignore:
Timestamp:
06/20/16 08:40:10 (18 months ago)
Author:
ocean90
Message:

Plugin Directory: Don't display a locale banner if a plugin is translated into the locale of the current site.

See #1728.

File:
1 edited

Legend:

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

    r3474 r3491  
    6363        // Build a list of WordPress locales which we'll suggest to the user. 
    6464        $suggest_locales = array_values( array_intersect( $translated_locales, $locales_from_header ) ); 
    65         $suggest_locales = array_diff( $suggest_locales, [ $current_locale ] ); 
     65        $current_locale_is_suggested = in_array( $current_locale, $suggest_locales ); 
     66        if ( $current_locale_is_suggested ) { 
     67            $suggest_locales = array_diff( $suggest_locales, [ $current_locale ] ); 
     68        } 
    6669 
    6770        // Get the native language names of the locales. 
     
    8689            $suggest_string = sprintf( 
    8790                /* translators: %s: native language name. */ 
    88                 __( 'This plugin also available in %s.', 'wporg-plugins' ), 
     91                __( 'This plugin is also available in %s.', 'wporg-plugins' ), 
    8992                sprintf( 
    9093                    '<a href="https://%s.wordpress.org/plugins-wp/%s/">%s</a>', 
     
    111114            $suggest_string = sprintf( 
    112115                /* translators: 1: native language name, 2: native language names */ 
    113                 __( 'This plugin also available in %1$s (also: %2$s).', 'wporg-plugins' ), 
     116                __( 'This plugin is also available in %1$s (also: %2$s).', 'wporg-plugins' ), 
    114117                sprintf( 
    115118                    '<a href="https://%s.wordpress.org/plugins-wp/%s/">%s</a>', 
     
    120123                trim( $other_suggest, ' ,' ) 
    121124            ); 
    122         } elseif ( 'en_US' !== $current_locale ) { 
     125        } elseif ( 'en_US' !== $current_locale && ! $current_locale_is_suggested ) { 
    123126            $suggest_string = sprintf( 
    124127                /* translators: %s: URL to translate.wordpress.org */ 
Note: See TracChangeset for help on using the changeset viewer.