Making WordPress.org


Ignore:
Timestamp:
07/23/2020 04:01:51 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Allow the plugin_information endpoint to return the language pack for the requested locale.

This will allow for a WordPress to install the translations for a plugin at the same time as a plugin.

File:
1 edited

Legend:

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

    r9768 r10091  
    178178                }
    179179            }
     180        }
     181
     182        // Only include language packs for the requested locale.
     183        if ( ! empty( $fields['language_pack'] ) ) {
     184            $response['language_pack'] = array_values( array_filter( $response['language_pack'], function( $item ) use ( $request ) {
     185                return ( $request->locale === $item['language'] );
     186            } ) );
    180187        }
    181188
Note: See TracChangeset for help on using the changeset viewer.