Accessibility: Posts, Post Types: Replace `@` with `at` in the displayed date format.

The `@` symbol makes sense in the context of email addresses, but does not have a universal meaning in the context of dates.

Props birgire, afercia, audrasjb, SergeyBiryukov.
Fixes #47832.
Built from https://develop.svn.wordpress.org/trunk@46083


git-svn-id: http://core.svn.wordpress.org/trunk@45895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-08 23:24:56 +00:00
parent 0393a78206
commit f8ba775d7c
5 changed files with 38 additions and 15 deletions

View File

@ -166,8 +166,14 @@ if ( $viewable ) {
} }
$scheduled_date = sprintf(
/* translators: Publish box date string. 1: Date, 2: Time. */
__( '%1$s at %2$s' ),
/* translators: Publish box date format, see https://secure.php.net/date */ /* translators: Publish box date format, see https://secure.php.net/date */
$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) ); date_i18n( _x( 'M j, Y', 'publish box date format' ), strtotime( $post->post_date ) ),
/* translators: Publish box time format, see https://secure.php.net/date */
date_i18n( _x( 'H:i', 'publish box time format' ), strtotime( $post->post_date ) )
);
$messages['post'] = array( $messages['post'] = array(
0 => '', // Unused. Messages start at index 1. 0 => '', // Unused. Messages start at index 1.

View File

@ -194,28 +194,41 @@ function post_submit_meta_box( $post, $args = array() ) {
</div><!-- .misc-pub-section --> </div><!-- .misc-pub-section -->
<?php <?php
/* translators: Publish box date string. 1: Date, 2: Time. See https://secure.php.net/date */
$date_string = __( '%1$s at %2$s' );
/* translators: Publish box date format, see https://secure.php.net/date */ /* translators: Publish box date format, see https://secure.php.net/date */
$datef = __( 'M j, Y @ H:i' ); $date_format = _x( 'M j, Y', 'publish box date format' );
/* translators: Publish box time format, see https://secure.php.net/date */
$time_format = _x( 'H:i', 'publish box time format' );
if ( 0 != $post->ID ) { if ( 0 != $post->ID ) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
/* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */ /* translators: Post date information. %s: Date on which the post is currently scheduled to be published. */
$stamp = __( 'Scheduled for: <b>%s</b>' ); $stamp = __( 'Scheduled for: %s' );
} elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published } elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
/* translators: Post date information. %s: Date on which the post was published. */ /* translators: Post date information. %s: Date on which the post was published. */
$stamp = __( 'Published on: <b>%s</b>' ); $stamp = __( 'Published on: %s' );
} elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified } elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
$stamp = __( 'Publish <b>immediately</b>' ); $stamp = __( 'Publish <b>immediately</b>' );
} elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified } elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
/* translators: Post date information. %s: Date on which the post is to be published. */ /* translators: Post date information. %s: Date on which the post is to be published. */
$stamp = __( 'Schedule for: <b>%s</b>' ); $stamp = __( 'Schedule for: %s' );
} else { // draft, 1 or more saves, date specified } else { // draft, 1 or more saves, date specified
/* translators: Post date information. %s: Date on which the post is to be published. */ /* translators: Post date information. %s: Date on which the post is to be published. */
$stamp = __( 'Publish on: <b>%s</b>' ); $stamp = __( 'Publish on: %s' );
} }
$date = date_i18n( $datef, strtotime( $post->post_date ) ); $date = sprintf(
$date_string,
date_i18n( $date_format, strtotime( $post->post_date ) ),
date_i18n( $time_format, strtotime( $post->post_date ) )
);
} else { // draft (no saves, and thus no date specified) } else { // draft (no saves, and thus no date specified)
$stamp = __( 'Publish <b>immediately</b>' ); $stamp = __( 'Publish <b>immediately</b>' );
$date = date_i18n( $datef, strtotime( current_time( 'mysql' ) ) ); $date = sprintf(
$date_string,
date_i18n( $date_format, strtotime( current_time( 'mysql' ) ) ),
date_i18n( $time_format, strtotime( current_time( 'mysql' ) ) )
);
} }
if ( ! empty( $args['args']['revisions_count'] ) ) : if ( ! empty( $args['args']['revisions_count'] ) ) :
@ -234,8 +247,12 @@ endif;
?> ?>
<div class="misc-pub-section curtime misc-pub-curtime"> <div class="misc-pub-section curtime misc-pub-curtime">
<span id="timestamp"> <span id="timestamp">
<?php printf( $stamp, $date ); ?></span> <?php printf( $stamp, '<b>' . $date . '</b>' ); ?>
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a> </span>
<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" role="button">
<span aria-hidden="true"><?php _e( 'Edit' ); ?></span>
<span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span>
</a>
<fieldset id="timestampdiv" class="hide-if-js"> <fieldset id="timestampdiv" class="hide-if-js">
<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend> <legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
<?php touch_time( ( $action === 'edit' ), 1 ); ?> <?php touch_time( ( $action === 'edit' ), 1 ); ?>

View File

@ -824,7 +824,7 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
echo '<div class="timestamp-wrap">'; echo '<div class="timestamp-wrap">';
/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */ /* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
printf( __( '%1$s %2$s, %3$s @ %4$s:%5$s' ), $month, $day, $year, $hour, $minute ); printf( __( '%1$s %2$s, %3$s at %4$s:%5$s' ), $month, $day, $year, $hour, $minute );
echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />'; echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';

View File

@ -1583,7 +1583,7 @@ function wp_default_scripts( &$scripts ) {
'publishOnFuture' => __( 'Schedule for:' ), 'publishOnFuture' => __( 'Schedule for:' ),
'publishOnPast' => __( 'Published on:' ), 'publishOnPast' => __( 'Published on:' ),
/* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */ /* translators: 1: Month, 2: Day, 3: Year, 4: Hour, 5: Minute. */
'dateFormat' => __( '%1$s %2$s, %3$s @ %4$s:%5$s' ), 'dateFormat' => __( '%1$s %2$s, %3$s at %4$s:%5$s' ),
'showcomm' => __( 'Show more comments' ), 'showcomm' => __( 'Show more comments' ),
'endcomm' => __( 'No more comments found.' ), 'endcomm' => __( 'No more comments found.' ),
'publish' => __( 'Publish' ), 'publish' => __( 'Publish' ),

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-46082'; $wp_version = '5.3-alpha-46083';
/** /**
* 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.