Make WordPress Core

Changeset 58217


Ignore:
Timestamp:
05/27/2024 07:42:15 PM (7 weeks ago)
Author:
joedolson
Message:

Media: Add missing units for length and dimensions in media library.

Include explicit units for media length and dimensions in attachment modal and media details screen.

Props Presskopp, joedolson, shailu25, audrasjb.
Fixes #59009.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/media.php

    r57648 r58217  
    16651665
    16661666    if ( isset( $meta['width'], $meta['height'] ) ) {
    1667         $media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
     1667        /* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
     1668        $media_dims .= "<span id='media-dims-$post->ID'>" . sprintf( __( '%1$s by %2$s pixels' ), $meta['width'], $meta['height'] ) . '</span>';
    16681669    }
    16691670
     
    33073308
    33083309    if ( isset( $meta['width'], $meta['height'] ) ) {
    3309         $media_dims .= "<span id='media-dims-$attachment_id'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
     3310        /* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
     3311        $media_dims .= "<span id='media-dims-$attachment_id'>" . sprintf( __( '%1$s by %2$s pixels' ), $meta['width'], $meta['height'] ) . '</span>';
    33103312    }
    33113313    /** This filter is documented in wp-admin/includes/media.php */
     
    34423444                        }
    34433445                        break;
     3446                    case 'length_formatted':
     3447                        echo human_readable_duration( $meta['length_formatted'] );
     3448                        break;
    34443449                    default:
    34453450                        echo esc_html( $meta[ $key ] );
  • trunk/src/wp-includes/media-template.php

    r56711 r58217  
    484484                <# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
    485485                    <div class="file-length"><strong><?php _e( 'Length:' ); ?></strong>
    486                         <span aria-hidden="true">{{ data.fileLength }}</span>
     486                        <span aria-hidden="true">{{ data.fileLengthHumanReadable }}</span>
    487487                        <span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
    488488                    </div>
     
    730730                <# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
    731731                    <div class="file-length"><?php _e( 'Length:' ); ?>
    732                         <span aria-hidden="true">{{ data.fileLength }}</span>
     732                        <span aria-hidden="true">{{ data.fileLengthHumanReadable }}</span>
    733733                        <span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
    734734                    </div>
Note: See TracChangeset for help on using the changeset viewer.