From bc4eb46b5577bae4fc48f0cebac0f0d037939db0 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Sun, 26 Nov 2023 16:41:34 +0000 Subject: [PATCH] I18N: Improve translator comments for strings containing date formats. Adds translator comments where absent and changes code style so that comments are attached to the right strings during string extraction. Props NekoJonez. Fixes #59947 git-svn-id: https://develop.svn.wordpress.org/trunk@57136 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-form-advanced.php | 17 +++++++++++++---- src/wp-admin/includes/ajax-actions.php | 9 +++++++-- src/wp-admin/includes/meta-boxes.php | 2 +- src/wp-admin/update-core.php | 11 +++++++++-- src/wp-includes/general-template.php | 3 +++ src/wp-includes/theme-compat/sidebar.php | 2 ++ 6 files changed, 35 insertions(+), 9 deletions(-) diff --git a/src/wp-admin/edit-form-advanced.php b/src/wp-admin/edit-form-advanced.php index dc3623606c6fb..16b699ca39293 100644 --- a/src/wp-admin/edit-form-advanced.php +++ b/src/wp-admin/edit-form-advanced.php @@ -649,11 +649,20 @@ echo ''; $last_user = get_userdata( get_post_meta( $post->ID, '_edit_last', true ) ); if ( $last_user ) { - /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */ - printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); + printf( + /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time. */ + __( 'Last edited by %1$s on %2$s at %3$s' ), + esc_html( $last_user->display_name ), + mysql2date( __( 'F j, Y' ), $post->post_modified ), + mysql2date( __( 'g:i a' ), $post->post_modified ) + ); } else { - /* translators: 1: Post edited date, 2: Post edited time. */ - printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); + printf( + /* translators: 1: Post edited date, 2: Post edited time. */ + __( 'Last edited on %1$s at %2$s' ), + mysql2date( __( 'F j, Y' ), $post->post_modified ), + mysql2date( __( 'g:i a' ), $post->post_modified ) + ); } echo ''; } diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 69f5fd469ca94..b8e8246eb7c52 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -1628,8 +1628,13 @@ function wp_ajax_add_meta() { $post_data['post_type'] = $post->post_type; $post_data['post_status'] = 'draft'; $now = time(); - /* translators: 1: Post creation date, 2: Post creation time. */ - $post_data['post_title'] = sprintf( __( 'Draft created on %1$s at %2$s' ), gmdate( __( 'F j, Y' ), $now ), gmdate( __( 'g:i a' ), $now ) ); + + $post_data['post_title'] = sprintf( + /* translators: 1: Post creation date, 2: Post creation time. */ + __( 'Draft created on %1$s at %2$s' ), + gmdate( __( 'F j, Y' ), $now ), + gmdate( __( 'g:i a' ), $now ) + ); $pid = edit_post( $post_data ); diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index 5228076079b29..387910e9189e5 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/wp-admin/includes/meta-boxes.php @@ -434,7 +434,7 @@ function attachment_submit_meta_box( $post ) { post_date ) ), diff --git a/src/wp-admin/update-core.php b/src/wp-admin/update-core.php index 7ff74569be503..c34ac06f242e6 100644 --- a/src/wp-admin/update-core.php +++ b/src/wp-admin/update-core.php @@ -1105,8 +1105,15 @@ function do_undismiss_core_update() { echo ''; echo '

'; - /* translators: 1: Date, 2: Time. */ - printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ), $last_update_check ), date_i18n( __( 'g:i a T' ), $last_update_check ) ); + + printf( + /* translators: 1: Date, 2: Time. */ + __( 'Last checked on %1$s at %2$s.' ), + /* translators: Last update date format. See https://www.php.net/manual/datetime.format.php */ + date_i18n( __( 'F j, Y' ), $last_update_check ), + /* translators: Last update time format. See https://www.php.net/manual/datetime.format.php */ + date_i18n( __( 'g:i a T' ), $last_update_check ) + ); echo ' ' . __( 'Check again.' ) . ''; echo '

'; diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 17cce960744b7..28fb3394d22da 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -1715,12 +1715,15 @@ function get_the_archive_title() { $title = get_the_author(); $prefix = _x( 'Author:', 'author archive title prefix' ); } elseif ( is_year() ) { + /* translators: See https://www.php.net/manual/datetime.format.php */ $title = get_the_date( _x( 'Y', 'yearly archives date format' ) ); $prefix = _x( 'Year:', 'date archive title prefix' ); } elseif ( is_month() ) { + /* translators: See https://www.php.net/manual/datetime.format.php */ $title = get_the_date( _x( 'F Y', 'monthly archives date format' ) ); $prefix = _x( 'Month:', 'date archive title prefix' ); } elseif ( is_day() ) { + /* translators: See https://www.php.net/manual/datetime.format.php */ $title = get_the_date( _x( 'F j, Y', 'daily archives date format' ) ); $prefix = _x( 'Day:', 'date archive title prefix' ); } elseif ( is_tax( 'post_format' ) ) { diff --git a/src/wp-includes/theme-compat/sidebar.php b/src/wp-includes/theme-compat/sidebar.php index da4efaa86c9df..f27fce57806e6 100644 --- a/src/wp-includes/theme-compat/sidebar.php +++ b/src/wp-includes/theme-compat/sidebar.php @@ -56,6 +56,7 @@ /* translators: 1: Site link, 2: Archive date. */ __( 'You are currently browsing the %1$s blog archives for the day %2$s.' ), sprintf( '%2$s', get_bloginfo( 'url' ), get_bloginfo( 'name' ) ), + /* translators: Daily archives date format. See https://www.php.net/manual/datetime.format.php */ get_the_time( __( 'l, F jS, Y' ) ) ); ?> @@ -68,6 +69,7 @@ /* translators: 1: Site link, 2: Archive month. */ __( 'You are currently browsing the %1$s blog archives for %2$s.' ), sprintf( '%2$s', get_bloginfo( 'url' ), get_bloginfo( 'name' ) ), + /* translators: Monthly archives date format. See https://www.php.net/manual/datetime.format.php */ get_the_time( __( 'F, Y' ) ) ); ?>