Making WordPress.org


Ignore:
Timestamp:
07/26/2020 01:42:13 AM (4 years ago)
Author:
dd32
Message:

Plugin Directory: API: Return all available language packs for the plugin if requested, not just the current request locale.

On multi-site installs, it's expected that a client may need to install multiple language packs for the site.

This API isn't currently in use, so no back-compat is included.

Ammends [10091].

File:
1 edited

Legend:

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

    r10092 r10098  
    226226
    227227        // Translations.
    228         $result['language_pack'] = [];
     228        $result['language_packs'] = [];
    229229        if ( defined ( 'API_WPORGPATH' ) && file_exists( API_WPORGPATH . '/translations/lib.php' ) ) {
    230230            require_once API_WPORGPATH . '/translations/lib.php';
    231231
    232             $result['language_pack'] = find_all_translations_for_type_and_domain(
     232            $result['language_packs'] = find_all_translations_for_type_and_domain(
    233233                'plugin',
    234234                $result['slug'],
    235235                $result['version']
    236236            );
    237             $result['language_pack'] = array_map( function( $item ) use ( $result ) {
     237            $result['language_packs'] = array_map( function( $item ) use ( $result ) {
    238238                return [
    239239                    'type'     => 'plugin',
     
    244244                    'package'  => $item->package,
    245245                ];
    246             }, $result['language_pack'] );
     246            }, $result['language_packs'] );
    247247        }
    248248
Note: See TracChangeset for help on using the changeset viewer.