Media: Change wording for media files which aren't attached.

The media library can contain files which aren't attached yet. When attaching a file you currently get "Media attachment reattached.", or the opposite "Media attachment detached.". That's redundant and can be inaccurate. It's also not easy to translate in some languages.

This change generalizes the strings to refer to a "media file" instead.

Props SergeyBiryukov, ocean90, netweb.
Fixes #36089.
Built from https://develop.svn.wordpress.org/trunk@36887


git-svn-id: http://core.svn.wordpress.org/trunk@36854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2016-03-08 17:43:25 +00:00
parent 67475a943f
commit 7e8e3429e1
6 changed files with 27 additions and 27 deletions

View File

@ -160,7 +160,7 @@ $messages['page'] = array(
9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html, 9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html,
10 => __( 'Page draft updated.' ) . $preview_page_link_html, 10 => __( 'Page draft updated.' ) . $preview_page_link_html,
); );
$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now. $messages['attachment'] = array_fill( 1, 10, __( 'Media file updated.' ) ); // Hack, for now.
/** /**
* Filter the post updated messages. * Filter the post updated messages.

View File

@ -213,7 +213,7 @@ class WP_Media_List_Table extends WP_List_Table {
* @access public * @access public
*/ */
public function no_items() { public function no_items() {
_e( 'No media attachments found.' ); _e( 'No media files found.' );
} }
/** /**

View File

@ -92,7 +92,7 @@ case 'edit' :
if ( isset($_GET['message']) ) { if ( isset($_GET['message']) ) {
switch ( $_GET['message'] ) { switch ( $_GET['message'] ) {
case 'updated' : case 'updated' :
$message = __('Media attachment updated.'); $message = __('Media file updated.');
$class = 'updated'; $class = 'updated';
break; break;
} }

View File

@ -199,7 +199,7 @@ get_current_screen()->add_help_tab( array(
'id' => 'attaching-files', 'id' => 'attaching-files',
'title' => __('Attaching Files'), 'title' => __('Attaching Files'),
'content' => 'content' =>
'<p>' . __( 'If a media file has not been attached to any post, you will see that in the Attached To column, and can click on Attach File to launch a small popup that will allow you to search for a post and attach the file.' ) . '</p>' '<p>' . __( 'If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.' ) . '</p>'
) ); ) );
get_current_screen()->set_help_sidebar( get_current_screen()->set_help_sidebar(
@ -234,16 +234,16 @@ if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
<?php <?php
$message = ''; $message = '';
if ( ! empty( $_GET['posted'] ) ) { if ( ! empty( $_GET['posted'] ) ) {
$message = __( 'Media attachment updated.' ); $message = __( 'Media file updated.' );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
} }
if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) { if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
if ( 1 == $attached ) { if ( 1 == $attached ) {
$message = __( 'Media attachment reattached.' ); $message = __( 'Media file attached.' );
} else { } else {
/* translators: %s: number of media attachments */ /* translators: %s: number of media files */
$message = _n( '%s media attachment reattached.', '%s media attachments reattached.', $attached ); $message = _n( '%s media file attached.', '%s media files attached.', $attached );
} }
$message = sprintf( $message, number_format_i18n( $attached ) ); $message = sprintf( $message, number_format_i18n( $attached ) );
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
@ -251,10 +251,10 @@ if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) { if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
if ( 1 == $detached ) { if ( 1 == $detached ) {
$message = __( 'Media attachment detached.' ); $message = __( 'Media file detached.' );
} else { } else {
/* translators: %s: number of media attachments */ /* translators: %s: number of media files */
$message = _n( '%s media attachment detached.', '%s media attachments detached.', $detached ); $message = _n( '%s media file detached.', '%s media filse detached.', $detached );
} }
$message = sprintf( $message, number_format_i18n( $detached ) ); $message = sprintf( $message, number_format_i18n( $detached ) );
$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] ); $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
@ -262,10 +262,10 @@ if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) { if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
if ( 1 == $deleted ) { if ( 1 == $deleted ) {
$message = __( 'Media attachment permanently deleted.' ); $message = __( 'Media file permanently deleted.' );
} else { } else {
/* translators: %s: number of media attachments */ /* translators: %s: number of media files */
$message = _n( '%s media attachment permanently deleted.', '%s media attachments permanently deleted.', $deleted ); $message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted );
} }
$message = sprintf( $message, number_format_i18n( $deleted ) ); $message = sprintf( $message, number_format_i18n( $deleted ) );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
@ -273,10 +273,10 @@ if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) { if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
if ( 1 == $trashed ) { if ( 1 == $trashed ) {
$message = __( 'Media attachment moved to the trash.' ); $message = __( 'Media file moved to the trash.' );
} else { } else {
/* translators: %s: number of media attachments */ /* translators: %s: number of media files */
$message = _n( '%s media attachment moved to the trash.', '%s media attachments moved to the trash.', $trashed ); $message = _n( '%s media file moved to the trash.', '%s media files moved to the trash.', $trashed );
} }
$message = sprintf( $message, number_format_i18n( $trashed ) ); $message = sprintf( $message, number_format_i18n( $trashed ) );
$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>'; $message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
@ -285,20 +285,20 @@ if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) { if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
if ( 1 == $untrashed ) { if ( 1 == $untrashed ) {
$message = __( 'Media attachment restored from the trash.' ); $message = __( 'Media file restored from the trash.' );
} else { } else {
/* translators: %s: number of media attachments */ /* translators: %s: number of media files */
$message = _n( '%s media attachment restored from the trash.', '%s media attachments restored from the trash.', $untrashed ); $message = _n( '%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed );
} }
$message = sprintf( $message, number_format_i18n( $untrashed ) ); $message = sprintf( $message, number_format_i18n( $untrashed ) );
$_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']); $_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
} }
$messages[1] = __( 'Media attachment updated.' ); $messages[1] = __( 'Media file updated.' );
$messages[2] = __( 'Media attachment permanently deleted.' ); $messages[2] = __( 'Media file permanently deleted.' );
$messages[3] = __( 'Error saving media attachment.' ); $messages[3] = __( 'Error saving media file.' );
$messages[4] = __( 'Media attachment moved to the trash.' ) . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __( 'Undo' ) . '</a>'; $messages[4] = __( 'Media file moved to the trash.' ) . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __( 'Undo' ) . '</a>';
$messages[5] = __( 'Media attachment restored from the trash.' ); $messages[5] = __( 'Media file restored from the trash.' );
if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) { if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
$message = $messages[ $_GET['message'] ]; $message = $messages[ $_GET['message'] ];

View File

@ -3362,7 +3362,7 @@ function wp_enqueue_media( $args = array() ) {
'filterByDate' => __( 'Filter by date' ), 'filterByDate' => __( 'Filter by date' ),
'filterByType' => __( 'Filter by type' ), 'filterByType' => __( 'Filter by type' ),
'searchMediaLabel' => __( 'Search Media' ), 'searchMediaLabel' => __( 'Search Media' ),
'noMedia' => __( 'No media attachments found.' ), 'noMedia' => __( 'No media files found.' ),
// Library Details // Library Details
'attachmentDetails' => __( 'Attachment Details' ), 'attachmentDetails' => __( 'Attachment Details' ),

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.5-beta2-36886'; $wp_version = '4.5-beta2-36887';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.