WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 weeks ago

#30506 new defect (bug)

RTL: Hours and minutes fields order reversed in post editing

Reported by: leac Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.0
Component: Editor Keywords: has-patch commit
Focuses: ui, rtl Cc:

Description (last modified by yoavf)

Steps to reproduce:

  1. Use RTL language (i.e. Hebrew, Arabic)
  2. Edit post
  3. Edit scheduled publish time
  4. See that the order of the hours field and the minutes field are reversed:

https://core.trac.wordpress.org/raw-attachment/ticket/30506/wp_bug_1.jpg

It happens in Quick edit too:

  1. Use RTL language (i.e. Hebrew, Arabic)
  2. Quick edit a post
  3. See that the order of the hours field and the minutes field are reversed:

https://core.trac.wordpress.org/raw-attachment/ticket/30506/wp_bug_2.jpg

Attachments (3)

wp_bug_1.jpg (112.1 KB) - added by leac 3 years ago.
RTl reversed time field order in edit post
wp_bug_2.jpg (64.0 KB) - added by leac 3 years ago.
RTl reversed time field order in quick edit post
30506.patch (5.5 KB) - added by SergeyBiryukov 10 months ago.

Download all attachments as: .zip

Change History (19)

@leac
3 years ago

RTl reversed time field order in edit post

@leac
3 years ago

RTl reversed time field order in quick edit post

#1 @yoavf
3 years ago

  • Description modified (diff)
  • Keywords needs-patch added

#2 @leac
3 years ago

  • Summary changed from RTL: Hours and minutes fields order reversed in post quick editing to RTL: Hours and minutes fields order reversed in post editing

#3 @ocean90
3 years ago

  • Component changed from Administration to Posts, Post Types
  • Focuses ui added

#4 follow-up: @leac
3 years ago

I dug into the code, and found that the code that creates all text fields in schedule editing is in
wp-admin\includes\template.php (row 753 in 4.0.1):

/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
printf( __( '%1$s %2$s, %3$s @ %4$s : %5$s' ), $month, $day, $year, $hour, $minute );

Then I checked if that string appears anywhere else. I found that it is used one other place, in
wp-includes\script-loader.php (row 444 in 4.0.1), where it's assigned to the dateFormat field in the postL10n object:

'dateFormat' => __('%1$s %2$s, %3$s @ %4$s : %5$s'),

That object and field is used in wp-admin/js/post.js (row 728 in 4.0.1), after submitting the new scheduled date.

So I was thinking that the easiest solution for the reversed hour and minute order problem would be to change the order of parameters %4$s and %5$s in the translation file:

%2$s %1$s, %3$s בשעה %5$s : %4$s

But that isn't a good solution semantically, because the hour and minute aren't really supposed to be reversed: the reversal would be done for display reasons only, and that's not semantically correct.

So I need a way to show the %4$s and %5$s from left to right, without changing their order in the string.

#5 in reply to: ↑ 4 @ramiy
3 years ago

Replying to leac:

I need a way to show the %4$s and %5$s from left to right, without changing their order in the string.

You can use the RTL Tester Plugin.

#6 @leac
3 years ago

I have it. How does it help me in this case?
I know how it looks in RTL, and I know how it looks in LTR.
I know where the problem is, just not how to solve it.

Last edited 3 years ago by leac (previous) (diff)

#7 @iseulde
3 years ago

  • Component changed from Posts, Post Types to Editor

#8 @SergeyBiryukov
10 months ago

  • Keywords has-patch commit added; needs-patch removed
  • Milestone changed from Awaiting Review to 4.8

#9 @adamsilverstein
6 months ago

tested 30506.patch and verified it fixes the issue reported in the ticket:

https://d3vv6lp55qjaqc.cloudfront.net/items/272O3u433L2X461D0D38/Image%202017-05-18%20at%2010.08.11%20AM.png

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


6 months ago

#11 @adamsilverstein
6 months ago

@SergeyBiryukov shall we go ahead and commit this or wait for 4.9?

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


6 months ago

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


6 months ago

#14 @obenland
6 months ago

  • Milestone changed from 4.8 to Future Release

#15 @leac
6 months ago

Thanks a lot for the patch! I too tested it and it works.
Would love to see it commited.

#16 @SergeyBiryukov
3 weeks ago

WP_Customize_Date_Time_Control::content_template() would likely need this change as well, see #42394.

Note: See TracTickets for help on using tickets.