Skip to content

Added relative time strings for the wp-date inline script output.#5101

Closed
ramonjd wants to merge 2 commits intoWordPress:trunkfrom
ramonjd:update/wp-date-inline-script-relative-strings
Closed

Added relative time strings for the wp-date inline script output.#5101
ramonjd wants to merge 2 commits intoWordPress:trunkfrom
ramonjd:update/wp-date-inline-script-relative-strings

Conversation

@ramonjd
Copy link
Copy Markdown
Member

@ramonjd ramonjd commented Aug 28, 2023

This PR syncs the changes in:

Updates wp_default_packages_inline_scripts() to add relative time strings to the wp-date inline 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.

Copy link
Copy Markdown
Member

@mukeshpanchal27 mukeshpanchal27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ramonjd for the PR. Left question related to text domain.

@oandregal oandregal requested a review from swissspidy August 28, 2023 10:35
@swissspidy
Copy link
Copy Markdown
Member

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.

@oandregal
Copy link
Copy Markdown
Member

oandregal commented Aug 28, 2023

Doesn't this also partially address https://core.trac.wordpress.org/ticket/47373?

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! :)

What I don't understand is why this was first addressed in Gutenberg and not just directly in core 🤷 Seems like unnecessary duplicate work.

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).

@audrasjb
Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants