Making WordPress.org


Ignore:
Timestamp:
05/03/2019 07:03:20 AM (5 years ago)
Author:
dd32
Message:

Plugin Directory: Introduce localised screenshots, allowing plugins to have translated screenshots on the website and within the wp-admin plugin installer.

This works by allowing screenshots located in the /assets/ folder to define the locale of the image, eg. screenshot-1-de_DE.png or screenshot-1-ary.png.

Props ck3lee, dd32.
See #3935.

File:
1 edited

Legend:

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

    r8654 r8729  
    365365        if ( $svn_assets_folder ) { // /assets/ may not exist.
    366366            foreach ( $svn_assets_folder as $asset ) {
    367                 // screenshot-0(-rtl).(png|jpg|jpeg|gif)  ||  icon.svg
    368                 if ( ! preg_match( '!^(?P<type>screenshot|banner|icon)(-(?P<resolution>[\dx]+)(-rtl)?\.(png|jpg|jpeg|gif)|\.svg)$!i', $asset['filename'], $m ) ) {
     367                // screenshot-0(-rtl)(-de_DE).(png|jpg|jpeg|gif)  ||  icon.svg
     368                if ( ! preg_match( '!^(?P<type>screenshot|banner|icon)(?:-(?P<resolution>[\dx]+)(-rtl)?(?:-(?P<locale>[a-z]{2,3}(?:_[A-Z]{2})?(?:_[a-z0-9]+)?))?\.(png|jpg|jpeg|gif)|\.svg)$!i', $asset['filename'], $m ) ) {
    369369                    continue;
    370370                }
     
    375375                $location   = 'assets';
    376376                $resolution = isset( $m['resolution'] ) ? $m['resolution'] : false;
    377 
    378                 $assets[ $type ][ $asset['filename'] ] = compact( 'filename', 'revision', 'resolution', 'location' );
     377                $locale     = isset( $m['locale'] )     ? $m['locale']     : false;
     378
     379                $assets[ $type ][ $asset['filename'] ] = compact( 'filename', 'revision', 'resolution', 'location', 'locale' );
    379380            }
    380381        }
Note: See TracChangeset for help on using the changeset viewer.