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.
Built from https://develop.svn.wordpress.org/trunk@58217


git-svn-id: http://core.svn.wordpress.org/trunk@57680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
joedolson 2024-05-27 19:44:14 +00:00
parent bba7f1effc
commit 3b1f9c8c28
3 changed files with 10 additions and 5 deletions

View File

@ -1664,7 +1664,8 @@ function get_media_item( $attachment_id, $args = null ) {
$meta = wp_get_attachment_metadata( $post->ID );
if ( isset( $meta['width'], $meta['height'] ) ) {
$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
/* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
$media_dims .= "<span id='media-dims-$post->ID'>" . sprintf( __( '%1$s by %2$s pixels' ), $meta['width'], $meta['height'] ) . '</span>';
}
/**
@ -3306,7 +3307,8 @@ function attachment_submitbox_metadata() {
$meta = wp_get_attachment_metadata( $attachment_id );
if ( isset( $meta['width'], $meta['height'] ) ) {
$media_dims .= "<span id='media-dims-$attachment_id'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
/* translators: 1: A number of pixels wide, 2: A number of pixels tall. */
$media_dims .= "<span id='media-dims-$attachment_id'>" . sprintf( __( '%1$s by %2$s pixels' ), $meta['width'], $meta['height'] ) . '</span>';
}
/** This filter is documented in wp-admin/includes/media.php */
$media_dims = apply_filters( 'media_meta', $media_dims, $post );
@ -3441,6 +3443,9 @@ function attachment_submitbox_metadata() {
echo ' ' . strtoupper( esc_html( $meta['bitrate_mode'] ) );
}
break;
case 'length_formatted':
echo human_readable_duration( $meta['length_formatted'] );
break;
default:
echo esc_html( $meta[ $key ] );
break;

View File

@ -483,7 +483,7 @@ function wp_print_media_templates() {
<# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
<div class="file-length"><strong><?php _e( 'Length:' ); ?></strong>
<span aria-hidden="true">{{ data.fileLength }}</span>
<span aria-hidden="true">{{ data.fileLengthHumanReadable }}</span>
<span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
</div>
<# } #>
@ -729,7 +729,7 @@ function wp_print_media_templates() {
<# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
<div class="file-length"><?php _e( 'Length:' ); ?>
<span aria-hidden="true">{{ data.fileLength }}</span>
<span aria-hidden="true">{{ data.fileLengthHumanReadable }}</span>
<span class="screen-reader-text">{{ data.fileLengthHumanReadable }}</span>
</div>
<# } #>

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.6-alpha-58216';
$wp_version = '6.6-alpha-58217';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.