Editor: Add relative time strings for the wp-date inline script output.

This changeset updates `wp_default_packages_inline_scripts()` to add relative time strings to the `wp-date` inline script, so the JS version of `human_time_diff` 
can output translated strings.

Props ramonopoly, oandregal, swissspidy, manzoorwanijk, adrianduffell, Presskopp.
Fixes #59219, #47373.




Built from https://develop.svn.wordpress.org/trunk@56496


git-svn-id: http://core.svn.wordpress.org/trunk@56008 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2023-08-30 22:11:12 +00:00
parent 42648581c7
commit 6687c0ec8f
2 changed files with 26 additions and 1 deletions

View File

@ -329,6 +329,7 @@ function wp_default_packages_scripts( $scripts ) {
* Adds inline scripts required for the WordPress JavaScript packages.
*
* @since 5.0.0
* @since 6.4.0 Added relative time strings for the `wp-date` inline script output.
*
* @global WP_Locale $wp_locale WordPress date and time locale object.
* @global wpdb $wpdb WordPress database abstraction object.
@ -430,6 +431,30 @@ function wp_default_packages_inline_scripts( $scripts ) {
'future' => __( '%s from now' ),
/* translators: %s: Duration. */
'past' => __( '%s ago' ),
/* translators: One second from or to a particular datetime, e.g., "a second ago" or "a second from now". */
's' => __( 'a second' ),
/* translators: %s: Duration in seconds from or to a particular datetime, e.g., "4 seconds ago" or "4 seconds from now". */
'ss' => __( '%d seconds' ),
/* translators: One minute from or to a particular datetime, e.g., "a minute ago" or "a minute from now". */
'm' => __( 'a minute' ),
/* translators: %s: Duration in minutes from or to a particular datetime, e.g., "4 minutes ago" or "4 minutes from now". */
'mm' => __( '%d minutes' ),
/* translators: %s: One hour from or to a particular datetime, e.g., "an hour ago" or "an hour from now". */
'h' => __( 'an hour' ),
/* translators: %s: Duration in hours from or to a particular datetime, e.g., "4 hours ago" or "4 hours from now". */
'hh' => __( '%d hours' ),
/* translators: %s: One day from or to a particular datetime, e.g., "a day ago" or "a day from now". */
'd' => __( 'a day' ),
/* translators: %s: Duration in days from or to a particular datetime, e.g., "4 days ago" or "4 days from now". */
'dd' => __( '%d days' ),
/* translators: %s: One month from or to a particular datetime, e.g., "a month ago" or "a month from now". */
'M' => __( 'a month' ),
/* translators: %s: Duration in months from or to a particular datetime, e.g., "4 months ago" or "4 months from now". */
'MM' => __( '%d months' ),
/* translators: %s: One year from or to a particular datetime, e.g., "a year ago" or "a year from now". */
'y' => __( 'a year' ),
/* translators: %s: Duration in years from or to a particular datetime, e.g., "4 years ago" or "4 years from now". */
'yy' => __( '%d years' ),
),
'startOfWeek' => (int) get_option( 'start_of_week', 0 ),
),

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.4-alpha-56495';
$wp_version = '6.4-alpha-56496';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.