Make WordPress Core

Opened 5 years ago

Closed 8 months ago

Last modified 6 months ago

#47373 closed defect (bug) (fixed)

Extend Moment.js localization

Reported by: swissspidy's profile swissspidy Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.4 Priority: normal
Severity: normal Version:
Component: I18N Keywords: good-first-bug has-patch commit
Focuses: Cc:

Description

With the Gutenberg integration we also got Moment.js in core with some localization support.

However, only a few of the fields that Moment.js supports are localized in WordPress. If a plugin wants to use some features like relative time (e.g. "%s hours ago"), these bits won't be translated.

I suggest also localizing thinks like relativeTime and potentially others.

See https://momentjs.com/docs/#/i18n/ for a full list of things that could be localized in core.

Similar enhancement in the past for jQuery UI datepicker: #29420

Attachments (2)

47373.diff (1.1 KB) - added by manzoorwani.jk 5 years ago.
ago.png (12.4 KB) - added by Presskopp 8 months ago.

Download all attachments as: .zip

Change History (29)

@manzoorwani.jk
5 years ago

#1 @manzoorwani.jk
5 years ago

  • Keywords has-patch added; needs-patch removed

It will need the changes in this file. I am on it as well.

#2 @manzoorwani.jk
5 years ago

Here is the corresponding PR to Gutenberg Repo. #16728

#3 @manzoorwani.jk
5 years ago

With the PR being merged, I guess this is now ready to go ahead.

This ticket was mentioned in Slack in #core-editor by talldanwp. View the logs.


5 years ago

This ticket was mentioned in Slack in #core by sergey. View the logs.


4 years ago

#6 @SergeyBiryukov
4 years ago

  • Milestone changed from Awaiting Review to 5.4
  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


4 years ago

#8 @davidbaumwald
4 years ago

  • Milestone changed from 5.4 to Future Release

This ticket still needs a review, and with 5.4 Beta 1 landing tomorrow, this is being moved to Future Release. If any maintainer or committer feels this can be included in 5.4 or wishes to assume ownership during a specific cycle, feel free to update the milestone accordingly.

#9 @adrianduffell
3 years ago

If a plugin wants to use some features like relative time (e.g. "%s hours ago"), these bits won't be translated.

This behavior occurs in WooCommerce where relative times are not translated.

Could the patch please be reviewed? Thank you.

This ticket was mentioned in Slack in #core by chihsuan. View the logs.


22 months ago

This ticket was mentioned in Slack in #core by chihsuan. View the logs.


22 months ago

#12 @costdev
22 months ago

  • Keywords dev-feedback added
  • Milestone changed from Future Release to 6.1

With this being raised in Slack recently, this issue is still relevant. The patch looks straightforward and I think we can land it in 6.1.

It would be good to get feedback from someone with more i18n experience than myself.

@swissspidy @SergeyBiryukov what else might this need to move forward?

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


19 months ago

#14 @JeffPaul
19 months ago

  • Milestone changed from 6.1 to 6.2

As discussed ahead of today's scheduled 6.1 Beta 1 release party (see the Slack link above), it was deemed that this ticket was not ready and should be punted to the 6.2 milestone to be reviewed and addressed then.

This ticket was mentioned in Slack in #core by costdev. View the logs.


15 months ago

#16 @hellofromTonya
15 months ago

Hello all,

I see that Gutenberg's instance got an update. I'm curious:

Does it meet the needs of the enhancement request in this ticket?

If yes, then it might worth someone comparing the latest code https://github.com/WordPress/gutenberg/blob/trunk/packages/date/src/index.js#L70 to determine if the patch in this ticket is up-to-date.

This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.


15 months ago

#18 @costdev
15 months ago

This ticket was discussed during the recent bug scrub.

@SergeyBiryukov As the patch may need to be revised, and we're approaching 6.2 Beta 1 on February 7th, is this ticket still on your radar for 6.2, or should it be moved to Future Release?

Additional props: @mukesh27

This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.


15 months ago

#20 @mukesh27
15 months ago

  • Milestone changed from 6.2 to Future Release

Thanks @swissspidy for the ticket.

This ticket was discussed during the bug scrub. As this ticket still needs discussion and 6.2 Beta 1 is being released today, I'll move this to Future Release.

Additional props: @costdev

#21 @Hareesh Pillai
10 months ago

  • Keywords needs-refresh added; has-patch removed

Since there has been an update in the Gutenberg code, the attached patch needs a refresh.

#22 @Presskopp
8 months ago

Looks like this issue is hitting us in the WP 6.3 Site Editor:

@Presskopp
8 months ago

#23 @swissspidy
8 months ago

Looks like the PR at https://github.com/WordPress/wordpress-develop/pull/5101 resolves this, with #59219 being a duplicate of this ticket.

#24 @audrasjb
8 months ago

  • Milestone changed from Future Release to 6.4

Moving to milestone 6.4 as this is going to be fixed by https://github.com/WordPress/wordpress-develop/pull/5101

#25 @audrasjb
8 months ago

  • Keywords has-patch commit added; dev-feedback needs-refresh removed
  • Type changed from enhancement to defect (bug)

#26 @audrasjb
8 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 56496:

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.

#27 @webcommsat
6 months ago

@audrasjb and @SergeyBiryukov, from reading this ticket, is this something worth highlighting as a dev note or as a miscellaneous dev note? Thanks

Note: See TracTickets for help on using tickets.