Added relative time strings for the wp-date inline script output.#5101
Added relative time strings for the wp-date inline script output.#5101ramonjd wants to merge 2 commits intoWordPress:trunkfrom
wp-date inline script output.#5101Conversation
mukeshpanchal27
left a comment
There was a problem hiding this comment.
Thanks @ramonjd for the PR. Left question related to text domain.
|
Doesn't this also partially address https://core.trac.wordpress.org/ticket/47373? What I don't understand is why this was first addressed in Gutenberg and not just directly in core 🤷 Seems like unnecessary duplicate work. |
Oh, I wasn't aware of it when I reported in Gutenberg. Thanks for sharing. I see the ticket is 4 years old, so thank you, @ramonjd, for addressing it! :)
I already commented here, though it's perhaps worth re-sharing: Gutenberg supports the last two WordPress releases. At the moment, WordPress 6.2 and WordPress 6.3. Even when/if the fix is released as part of WordPress 6.4, Gutenberg still has to support WordPress 6.3. I think it's worth enabling users to see the string in their language faster than 6.4 is available (and before they update). |
|
committed in https://core.trac.wordpress.org/changeset/56496 |
This PR syncs the changes in:
Updates
wp_default_packages_inline_scripts()to add relative time strings to thewp-dateinline script.This is so the JS version of human_time_diff can output translated strings.
It uses these translated strings in moment calculations. See the relevant model: https://momentjscom.readthedocs.io/en/latest/moment/07-customization/07-relative-time/
Trac ticket: https://core.trac.wordpress.org/ticket/59219
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.