Making WordPress.org

Changeset 9667


Ignore:
Timestamp:
04/01/2020 02:41:55 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Only show the "Localise this plugin!" locale banner if the plugin is prepared for translations.

Fixes #3604.

File:
1 edited

Legend:

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

    r7125 r9667  
    8181        $current_locale_is_translated = in_array( $current_locale, $translated_locales );
    8282
     83        // Check to see if the plugin is localizable.
     84        $current_plugin_is_translatable = true;
     85        if ( ! $current_locale_is_translated ) {
     86            $current_plugin_is_translatable = (bool) $wpdb->get_var( $wpdb->prepare(
     87                'SELECT id
     88                FROM translate_projects
     89                WHERE path IN( %s, %s ) AND active = 1
     90                LIMIT 1',
     91                'wp-plugins/' . $plugin_slug . '/dev',
     92                'wp-plugins/' . $plugin_slug . '/stable'
     93            ) );
     94        }
     95
    8396        // Get the native language names of the locales.
    8497        $suggest_named_locales = [];
     
    189202
    190203            // Localized directory.
    191         } elseif ( ! $current_locale_is_suggested && ! $current_locale_is_translated && $is_plugin_request ) {
     204        } elseif ( ! $current_locale_is_suggested && ! $current_locale_is_translated && $is_plugin_request && $current_plugin_is_translatable ) {
    192205            $suggest_string = sprintf(
    193206                $this->translate( 'This plugin is not translated into %1$s yet. <a href="%2$s">Help translate it!</a>', $current_locale ),
Note: See TracChangeset for help on using the changeset viewer.