Make WordPress Core

Changeset 56496


Ignore:
Timestamp:
08/30/2023 10:09:20 PM (14 months ago)
Author:
audrasjb
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/script-loader.php

    r56481 r56496  
    330330 *
    331331 * @since 5.0.0
     332 * @since 6.4.0 Added relative time strings for the `wp-date` inline script output.
    332333 *
    333334 * @global WP_Locale $wp_locale WordPress date and time locale object.
     
    431432                            /* translators: %s: Duration. */
    432433                            'past'   => __( '%s ago' ),
     434                            /* translators: One second from or to a particular datetime, e.g., "a second ago" or "a second from now". */
     435                            's'      => __( 'a second' ),
     436                            /* translators: %s: Duration in seconds from or to a particular datetime, e.g., "4 seconds ago" or "4 seconds from now". */
     437                            'ss'     => __( '%d seconds' ),
     438                            /* translators: One minute from or to a particular datetime, e.g., "a minute ago" or "a minute from now". */
     439                            'm'      => __( 'a minute' ),
     440                            /* translators: %s: Duration in minutes from or to a particular datetime, e.g., "4 minutes ago" or "4 minutes from now". */
     441                            'mm'     => __( '%d minutes' ),
     442                            /* translators: %s: One hour from or to a particular datetime, e.g., "an hour ago" or "an hour from now". */
     443                            'h'      => __( 'an hour' ),
     444                            /* translators: %s: Duration in hours from or to a particular datetime, e.g., "4 hours ago" or "4 hours from now". */
     445                            'hh'     => __( '%d hours' ),
     446                            /* translators: %s: One day from or to a particular datetime, e.g., "a day ago" or "a day from now". */
     447                            'd'      => __( 'a day' ),
     448                            /* translators: %s: Duration in days from or to a particular datetime, e.g., "4 days ago" or "4 days from now". */
     449                            'dd'     => __( '%d days' ),
     450                            /* translators: %s: One month from or to a particular datetime, e.g., "a month ago" or "a month from now". */
     451                            'M'      => __( 'a month' ),
     452                            /* translators: %s: Duration in months from or to a particular datetime, e.g., "4 months ago" or "4 months from now". */
     453                            'MM'     => __( '%d months' ),
     454                            /* translators: %s: One year from or to a particular datetime, e.g., "a year ago" or "a year from now". */
     455                            'y'      => __( 'a year' ),
     456                            /* translators: %s: Duration in years from or to a particular datetime, e.g., "4 years ago" or "4 years from now". */
     457                            'yy'     => __( '%d years' ),
    433458                        ),
    434459                        'startOfWeek'   => (int) get_option( 'start_of_week', 0 ),
Note: See TracChangeset for help on using the changeset viewer.