Make WordPress Core

Opened 7 years ago

Closed 3 years ago

Last modified 3 years ago

#47373 closed defect (bug) (fixed)

Extend Moment.js localization

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

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 7 years ago.
ago.png​ (12.4 KB ) - added by Presskopp 3 years ago.

Download all attachments as: .zip

Change History (29)

@manzoorwani.jk
7 years ago

#1 @manzoorwani.jk
7 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
7 years ago

Here is the corresponding PR to Gutenberg Repo. ​#16728

#3 @manzoorwani.jk
7 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.


7 years ago

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


7 years ago

#6 @SergeyBiryukov
7 years ago

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

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


7 years ago

#8 @davidbaumwald
7 years ago

  • Milestone 5.4 → 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
5 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.


4 years ago

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


4 years ago

#12 @costdev
4 years ago

  • Keywords dev-feedback added
  • Milestone Future Release → 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.


4 years ago

#14 @JeffPaul
4 years ago

  • Milestone 6.1 → 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.


4 years ago

#16 @hellofromTonya
4 years 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.


4 years ago

#18 @costdev
4 years 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.


4 years ago

#20 @mukesh27
4 years ago

  • Milestone 6.2 → 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
3 years 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
3 years ago

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

@Presskopp
3 years ago

#23 @swissspidy
3 years 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
3 years ago

  • Milestone Future Release → 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
3 years ago

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

#26 @audrasjb
3 years ago

  • Resolution → fixed
  • Status reviewing → 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
3 years 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.