How to change Wordpress Media Strings with media_view_strings filter -
hi want change strings in media popup found can filter $strings variable width media_view_strings filter , how can ?
i want change
here wp-includes/media.php file
$strings = array( // generic 'url' => __( 'url' ), 'addmedia' => __( 'add media' ), 'search' => __( 'search' ), 'select' => __( 'select' ), 'cancel' => __( 'cancel' ), 'update' => __( 'update' ), 'replace' => __( 'replace' ), 'remove' => __( 'remove' ), 'back' => __( 'back' ), /* translators: would-be plural string used in media manager. if there not word can use in language avoid issues lack of plural support here, turn "selected: %d" translate it. */ 'selected' => __( '%d selected' ), 'draginfo' => __( 'drag , drop reorder media files.' ), // upload 'uploadfilestitle' => __( 'upload files' ), 'uploadimagestitle' => __( 'upload images' ), // library 'medialibrarytitle' => __( 'media library' ), 'insertmediatitle' => __( 'insert media' ), 'createnewgallery' => __( 'create new gallery' ), 'createnewplaylist' => __( 'create new playlist' ), 'createnewvideoplaylist' => __( 'create new video playlist' ), 'returntolibrary' => __( '← return library' ), 'allmediaitems' => __( 'all media items' ), 'alldates' => __( 'all dates' ), 'noitemsfound' => __( 'no items found.' ), 'insertintopost' => $hier ? __( 'insert page' ) : __( 'insert post' ), 'unattached' => __( 'unattached' ), 'trash' => _x( 'trash', 'noun' ), 'uploadedtothispost' => $hier ? __( 'uploaded page' ) : __( 'uploaded post' ), 'warndelete' => __( "you permanently delete item.\n 'cancel' stop, 'ok' delete." ), 'warnbulkdelete' => __( "you permanently delete these items.\n 'cancel' stop, 'ok' delete." ), 'warnbulktrash' => __( "you trash these items.\n 'cancel' stop, 'ok' delete." ), 'bulkselect' => __( 'bulk select' ), 'cancelselection' => __( 'cancel selection' ), 'trashselected' => __( 'trash selected' ), 'untrashselected' => __( 'untrash selected' ), 'deleteselected' => __( 'delete selected' ), 'deletepermanently' => __( 'delete permanently' ), 'apply' => __( 'apply' ), 'filterbydate' => __( 'filter date' ), 'filterbytype' => __( 'filter type' ), 'searchmedialabel' => __( 'search media' ), 'nomedia' => __( 'no media attachments found.' ), // library details 'attachmentdetails' => __( 'attachment details' ), // url 'insertfromurltitle' => __( 'insert url' ), // featured images 'setfeaturedimagetitle' => $post_type_object->labels->featured_image, 'setfeaturedimage' => $post_type_object->labels->set_featured_image, // gallery 'creategallerytitle' => __( 'create gallery' ), 'editgallerytitle' => __( 'edit gallery' ), 'cancelgallerytitle' => __( '← cancel gallery' ), 'insertgallery' => __( 'insert gallery' ), 'updategallery' => __( 'update gallery' ), 'addtogallery' => __( 'add gallery' ), 'addtogallerytitle' => __( 'add gallery' ), 'reverseorder' => __( 'reverse order' ), // edit image 'imagedetailstitle' => __( 'image details' ), 'imagereplacetitle' => __( 'replace image' ), 'imagedetailscancel' => __( 'cancel edit' ), 'editimage' => __( 'edit image' ), // crop image 'chooseimage' => __( 'choose image' ), 'selectandcrop' => __( 'select , crop' ), 'skipcropping' => __( 'skip cropping' ), 'cropimage' => __( 'crop image' ), 'cropyourimage' => __( 'crop image' ), 'cropping' => __( 'cropping…' ), 'suggesteddimensions' => __( 'suggested image dimensions:' ), 'croperror' => __( 'there has been error cropping image.' ), // edit audio 'audiodetailstitle' => __( 'audio details' ), 'audioreplacetitle' => __( 'replace audio' ), 'audioaddsourcetitle' => __( 'add audio source' ), 'audiodetailscancel' => __( 'cancel edit' ), // edit video 'videodetailstitle' => __( 'video details' ), 'videoreplacetitle' => __( 'replace video' ), 'videoaddsourcetitle' => __( 'add video source' ), 'videodetailscancel' => __( 'cancel edit' ), 'videoselectposterimagetitle' => __( 'select poster image' ), 'videoaddtracktitle' => __( 'add subtitles' ), // playlist 'playlistdraginfo' => __( 'drag , drop reorder tracks.' ), 'createplaylisttitle' => __( 'create audio playlist' ), 'editplaylisttitle' => __( 'edit audio playlist' ), 'cancelplaylisttitle' => __( '← cancel audio playlist' ), 'insertplaylist' => __( 'insert audio playlist' ), 'updateplaylist' => __( 'update audio playlist' ), 'addtoplaylist' => __( 'add audio playlist' ), 'addtoplaylisttitle' => __( 'add audio playlist' ), // video playlist 'videoplaylistdraginfo' => __( 'drag , drop reorder videos.' ), 'createvideoplaylisttitle' => __( 'create video playlist' ), 'editvideoplaylisttitle' => __( 'edit video playlist' ), 'cancelvideoplaylisttitle' => __( '← cancel video playlist' ), 'insertvideoplaylist' => __( 'insert video playlist' ), 'updatevideoplaylist' => __( 'update video playlist' ), 'addtovideoplaylist' => __( 'add video playlist' ), 'addtovideoplaylisttitle' => __( 'add video playlist' ), ); /** * filter media view settings. * * @since 3.5.0 * * @param array $settings list of media view settings. * @param wp_post $post post object. */ $settings = apply_filters( 'media_view_settings', $settings, $post ); /** * filter media view strings. * * @since 3.5.0 * * @param array $strings list of media view strings. * @param wp_post $post post object. */ $strings = apply_filters( 'media_view_strings', $strings, $post );
that's all
try following code in plug-in:
function wdm_custom_media_view_strings( $strings ) { /* 1. copy , paste array $strings media.php 2. here can modify $strings per requirement. */ //do not forget return $strings return $strings; } add_filter('media_view_strings', 'wdm_custom_media_view_strings');
feel free ask doubts.
Comments
Post a Comment