Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Conversation

ramonjd
Copy link
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
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.

src/wp-includes/script-loader.php Outdated Show resolved Hide resolved
@swissspidy
Copy link
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
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
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