Make WordPress Core

Opened 9 years ago

Last modified 10 months ago

#36259 assigned defect (bug)

Switching language should update date and time formats

Reported by: sergeybiryukov's profile SergeyBiryukov Owned by: vagios's profile vagios
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: I18N Keywords: good-first-bug has-patch needs-testing needs-unit-tests
Focuses: Cc:

Description (last modified by SergeyBiryukov)

Previously: #11226

  1. Install WordPress in English.
  2. Switch language to Russian.
  3. Date and time formats in General Settings are still F j, Y and g:i a, which doesn't make sense for Russian and doesn't match the locale defaults (d.m.Y and H:i, respectively).

Attachments (4)

36259.patch (1.8 KB) - added by vagios 8 years ago.
36259.diff (1.9 KB) - added by jornp 10 months ago.
SCR-20231116-pdph.png (153.8 KB) - added by jornp 10 months ago.
Screenshot (before, English, default format selected)
SCR-20231116-pdtf.png (142.2 KB) - added by jornp 10 months ago.
Screenshot (after switching to Dutch, the default Dutch formats are selected)

Download all attachments as: .zip

Change History (20)

#1 @Clorith
9 years ago

This would need to account for those who have set their own date and time formats though, so as not to override user settings that may differ from what we expect from a locale.

#2 @swissspidy
9 years ago

This would need to account for those who have set their own date and time formats though, so as not to override user settings that may differ from what we expect from a locale.

It could work by not saving the date and time formats to the database until they differ from the ones specified by the locale.

This ticket was mentioned in Slack in #core-i18n by ocean90. View the logs.


8 years ago

#4 @SergeyBiryukov
8 years ago

  • Description modified (diff)

#5 @ocean90
8 years ago

  • Keywords needs-refresh good-first-bug added
  • Milestone changed from Awaiting Review to Future Release

@vagios
8 years ago

#6 follow-up: @vagios
8 years ago

  • Keywords has-patch added

In 36259.patch, if the locale's default date/time format is used, after the update the new locale's default values will be used. In any other case the code works as before.

#7 @DrewAPicture
8 years ago

Related-ish: #28344

#8 in reply to: ↑ 6 @only1andrewh
8 years ago

Replying to vagios:

In 36259.patch, if the locale's default date/time format is used, after the update the new locale's default values will be used. In any other case the code works as before.

I just tested this patch, and if left on the default time format it changes to the one specific to the chosen country.
Before applying the patch I confirmed that the old local was going into the custom format and active.

#9 @DrewAPicture
7 years ago

  • Owner set to vagios
  • Status changed from new to assigned

Assigning ownership to mark the good-first-bug as "claimed".

#10 @SergeyBiryukov
6 years ago

  • Milestone changed from Future Release to 5.0

#11 @pento
6 years ago

  • Milestone changed from 5.0 to 5.1

#12 @pento
6 years ago

  • Milestone changed from 5.1 to Future Release

Patch needs a refresh, testing, and review.

#13 @ocean90
3 years ago

#54923 was marked as a duplicate.

#14 @sarumbear
3 years ago

It is all good to mark https://core.trac.wordpress.org/ticket/54923 as duplicate but this is a six year old bug, which still has no defined milestone. How can we attract attention to it?

I find it strange that a bug that allowed a general setting, which has a dedicated page, to fail for six years. (I assume the code is the same between .com and .org.)

https://wordpress.com/support/language-settings/

#15 @seepops
23 months ago

I agree with @sarumbear this seems to be forgotten about. I have custom post types that use the published date and it is confusing and irritating not being able to change the dates in the admin to UK format i.e. dd/mm/yyyy. Please get this looked at.

@jornp
10 months ago

@jornp
10 months ago

Screenshot (before, English, default format selected)

@jornp
10 months ago

Screenshot (after switching to Dutch, the default Dutch formats are selected)

#16 @jornp
10 months ago

  • Keywords needs-testing needs-unit-tests added; needs-refresh removed

I've updated the patch to work with the current WordPress version. Also, in the original patch, the update_option calls were performed before the translations of the new locale were loaded. I've moved the calls to be performed right after the switch is made.

This patch seems to be working correctly, see the screenshots above. I think this could use some unit tests moving forward.

Note: See TracTickets for help on using tickets.