From 3b1f9c8c28ff536e284d7dd045bb0f667752279a Mon Sep 17 00:00:00 2001 From: joedolson Date: Mon, 27 May 2024 19:44:14 +0000 Subject: [PATCH] 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 --- wp-admin/includes/media.php | 9 +++++++-- wp-includes/media-template.php | 4 ++-- wp-includes/version.php | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php index 3de25dc548..e726c9a4a3 100644 --- a/wp-admin/includes/media.php +++ b/wp-admin/includes/media.php @@ -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 .= "{$meta['width']} × {$meta['height']} "; + /* translators: 1: A number of pixels wide, 2: A number of pixels tall. */ + $media_dims .= "" . sprintf( __( '%1$s by %2$s pixels' ), $meta['width'], $meta['height'] ) . ''; } /** @@ -3306,7 +3307,8 @@ function attachment_submitbox_metadata() { $meta = wp_get_attachment_metadata( $attachment_id ); if ( isset( $meta['width'], $meta['height'] ) ) { - $media_dims .= "{$meta['width']} × {$meta['height']} "; + /* translators: 1: A number of pixels wide, 2: A number of pixels tall. */ + $media_dims .= "" . sprintf( __( '%1$s by %2$s pixels' ), $meta['width'], $meta['height'] ) . ''; } /** 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; diff --git a/wp-includes/media-template.php b/wp-includes/media-template.php index 21adc09da0..a43a92cf32 100644 --- a/wp-includes/media-template.php +++ b/wp-includes/media-template.php @@ -483,7 +483,7 @@ function wp_print_media_templates() { <# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
- + {{ data.fileLengthHumanReadable }}
<# } #> @@ -729,7 +729,7 @@ function wp_print_media_templates() { <# if ( data.fileLength && data.fileLengthHumanReadable ) { #>
- + {{ data.fileLengthHumanReadable }}
<# } #> diff --git a/wp-includes/version.php b/wp-includes/version.php index db8fb1c4fa..3bed4ec617 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.