Make WordPress Core

Ticket #35095: 35095.diff

File 35095.diff, 6.3 KB (added by UaMV, 10 years ago)

A first pass at proper notice labeling for CPTs.

  • wp-admin/edit-form-advanced.php

     
    8383$messages = array();
    8484
    8585$preview_post_link_html = $scheduled_post_link_html = $view_post_link_html = '';
    86 $preview_page_link_html = $scheduled_page_link_html = $view_page_link_html = '';
    8786
    8887$preview_url = get_preview_post_link( $post );
    8988
     
    9493        // Preview post link.
    9594        $preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
    9695                esc_url( $preview_url ),
    97                 __( 'Preview post' )
     96                __( 'Preview ' . lcfirst( $post_type_object->labels->singular_name ) )
    9897        );
    9998
    10099        // Scheduled post preview link.
    101100        $scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
    102101                esc_url( $permalink ),
    103                 __( 'Preview post' )
     102                __( 'Preview ' . lcfirst( $post_type_object->labels->singular_name ) )
    104103        );
    105104
    106105        // View post link.
    107106        $view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>',
    108107                esc_url( $permalink ),
    109                 __( 'View post' )
     108                __( 'View ' . lcfirst( $post_type_object->labels->singular_name ) )
    110109        );
    111110
    112         // Preview page link.
    113         $preview_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
    114                 esc_url( $preview_url ),
    115                 __( 'Preview page' )
    116         );
    117 
    118         // Scheduled page preview link.
    119         $scheduled_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
    120                 esc_url( $permalink ),
    121                 __( 'Preview page' )
    122         );
    123 
    124         // View page link.
    125         $view_page_link_html = sprintf( ' <a href="%1$s">%2$s</a>',
    126                 esc_url( $permalink ),
    127                 __( 'View page' )
    128         );
    129 
    130111}
    131112
    132113/* translators: Publish box date format, see http://php.net/date */
    133114$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
    134115
    135 $messages['post'] = array(
     116$messages[ lcfirst( $post_type_object->labels->singular_name ) ] = array(
    136117         0 => '', // Unused. Messages start at index 1.
    137          1 => __( 'Post updated.' ) . $view_post_link_html,
     118         1 => __( $post_type_object->labels->singular_name . ' updated.' ) . $view_post_link_html,
    138119         2 => __( 'Custom field updated.' ),
    139120         3 => __( 'Custom field deleted.' ),
    140          4 => __( 'Post updated.' ),
     121         4 => __( $post_type_object->labels->singular_name . ' updated.' ),
    141122        /* translators: %s: date and time of the revision */
    142          5 => isset($_GET['revision']) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    143          6 => __( 'Post published.' ) . $view_post_link_html,
    144          7 => __( 'Post saved.' ),
    145          8 => __( 'Post submitted.' ) . $preview_post_link_html,
    146          9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
    147         10 => __( 'Post draft updated.' ) . $preview_post_link_html,
     123         5 => isset($_GET['revision']) ? sprintf( __( $post_type_object->labels->singular_name . ' restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
     124         6 => __( $post_type_object->labels->singular_name . ' published.' ) . $view_post_link_html,
     125         7 => __( $post_type_object->labels->singular_name . ' saved.' ),
     126         8 => __( $post_type_object->labels->singular_name . ' submitted.' ) . $preview_post_link_html,
     127         9 => sprintf( __( $post_type_object->labels->singular_name . ' scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
     128        10 => __( $post_type_object->labels->singular_name . ' draft updated.' ) . $preview_post_link_html,
    148129);
    149 $messages['page'] = array(
    150          0 => '', // Unused. Messages start at index 1.
    151          1 => __( 'Page updated.' ) . $view_page_link_html,
    152          2 => __( 'Custom field updated.' ),
    153          3 => __( 'Custom field deleted.' ),
    154          4 => __( 'Page updated.' ),
    155         /* translators: %s: date and time of the revision */
    156          5 => isset($_GET['revision']) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
    157          6 => __( 'Page published.' ) . $view_page_link_html,
    158          7 => __( 'Page saved.' ),
    159          8 => __( 'Page submitted.' ) . $preview_page_link_html,
    160          9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html,
    161         10 => __( 'Page draft updated.' ) . $preview_page_link_html,
    162 );
    163130$messages['attachment'] = array_fill( 1, 10, __( 'Media attachment updated.' ) ); // Hack, for now.
    164131
    165132/**
     
    176143        $_GET['message'] = absint( $_GET['message'] );
    177144        if ( isset($messages[$post_type][$_GET['message']]) )
    178145                $message = $messages[$post_type][$_GET['message']];
    179         elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) )
    180                 $message = $messages['post'][$_GET['message']];
    181146}
    182147
    183148$notice = false;
     
    429394if ( 'post' == $post_type ) {
    430395        $publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>';
    431396        $publish_box .= '<ul><li>' .
    432                 __( '<strong>Publish</strong> &mdash; You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) .
     397                __( '<strong>Publish</strong> &mdash; You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post. The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators.' ) .
    433398        '</li>';
    434399
    435400        if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) {