Opened 10 years ago
Closed 5 years ago
#30506 closed defect (bug) (fixed)
RTL: Hours and minutes fields order reversed in post editing
Reported by: | leac | Owned by: | adamsilverstein |
---|---|---|---|
Milestone: | 5.3 | Priority: | normal |
Severity: | normal | Version: | 4.0 |
Component: | Editor | Keywords: | has-patch needs-testing |
Focuses: | ui, rtl | Cc: |
Description (last modified by )
Steps to reproduce:
- Use RTL language (i.e. Hebrew, Arabic)
- Edit post
- Edit scheduled publish time
- See that the order of the hours field and the minutes field are reversed:
It happens in Quick edit too:
- Use RTL language (i.e. Hebrew, Arabic)
- Quick edit a post
- See that the order of the hours field and the minutes field are reversed:
Attachments (5)
Change History (55)
#2
@
10 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
#4
follow-up:
↓ 5
@
10 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
@
10 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
@
10 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.
#8
@
8 years ago
- Keywords has-patch commit added; needs-patch removed
- Milestone changed from Awaiting Review to 4.8
#9
@
7 years ago
tested 30506.patch and verified it fixes the issue reported in the ticket:
This ticket was mentioned in Slack in #core by flixos90. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by adamsilverstein. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by obenland. View the logs.
7 years ago
#15
@
7 years ago
Thanks a lot for the patch! I too tested it and it works.
Would love to see it commited.
#16
@
7 years ago
WP_Customize_Date_Time_Control::content_template()
would likely need this change as well, see #42394.
#18
in reply to:
↑ 17
@
6 years ago
Replying to iseulde:
This is no longer relevant after the merge of the block editor. Let's preserve the way it's currently built for the old editor.
I'm sorry, but could you explain why this is no longer relevant? The bug appears in the block editor as well.
In addition, as stated before, this bug exists also out of the editor - It happens in Quick edit too.
#19
follow-up:
↓ 22
@
6 years ago
Verifying I still see this issue in the block editor. I created a post at 12:20pm and switched my language to Hebrew, the result was this for the date picker:
If I understand correctly, the hour/minute fields should be reversed here with the left field showing the hours and the right field the minutes, is that right @leac ?
#20
@
6 years ago
- Status changed from new to reopened
Reopening because the reversed time field order in "quick edit" is still a valid issue.
@iseulde would it be better to create an issue in GitHub for the block editor issue?
#22
in reply to:
↑ 19
@
6 years ago
Replying to adamsilverstein:
Verifying I still see this issue in the block editor. I created a post at 12:20pm and switched my language to Hebrew, the result was this for the date picker:
If I understand correctly, the hour/minute fields should be reversed here with the left field showing the hours and the right field the minutes, is that right @leac ?
Hi Adam,
Thank you so much for taking the time to look into this and for reopening the ticket.
Yes, what your screenshot shows is exactly the bug.
Thanks again.
#25
@
5 years ago
Gutenberg issue: https://github.com/WordPress/gutenberg/issues/16373
#27
in reply to:
↑ 26
@
5 years ago
Replying to adamsilverstein:
Thank you for taking care of this!
Will the fix be only in the Gutenberg editor, or will it be also in the classic editor as well as the quick edit feature of the post list screen?
#28
follow-up:
↓ 29
@
5 years ago
The bug was FIXED.
The reason is wrong translation of the string %1$s %2$s, %3$s @ %4$s:%5$s
. Fixed by replacing :
with :
, It should be separated by spaces. Tested on WordPress 5.2. Then fixed in older versions, all the way back to WordPress 4.3. Before that, there was a different string.
Note: The patch is not required, in 12 hours all the Hebrew installations will be updated with new translation strings - WordPress 5.2 already updated.
#29
in reply to:
↑ 28
@
5 years ago
Hi Rami,
Thank you for the fix! It works great in the quick edit feature of the post list screen.
However, in the Classic Editor, the space makes the hours break to the next line. I don't know if you mind that, since people are supposed to be using Gutenberg, but I thought I'd at least bring it to your attention.
Replying to ramiy:
The bug was FIXED.
The reason is wrong translation of the string
%1$s %2$s, %3$s @ %4$s:%5$s
. Fixed by replacing:
with:
, It should be separated by spaces. Tested on WordPress 5.2. Then fixed in older versions, all the way back to WordPress 4.3. Before that, there was a different string.
Note: The patch is not required, in 12 hours all the Hebrew installations will be updated with new translation strings - WordPress 5.2 already updated.
#30
@
5 years ago
@ramiy to clarify - this issue was fixed in the translation files? is the patch no longer required? what about the Gutenberg change?
The reason is wrong translation of the string %1$s %2$s, %3$s @ %4$s:%5$s. Fixed by replacing : with : , It should be separated by spaces.
Can you clarify where you made that change? does this fix apply for all RTL languages?
#31
@
5 years ago
@leac Thanks for reporting, I'm looking for a solution.
@adamsilverstein The patch no longer required. Also, this fix is not affecting Gutenberg.
#32
@
5 years ago
Thanks for clarifying. I'm still seeing the incorrect order when switching my language to hebrew.
#33
follow-up:
↓ 34
@
5 years ago
@leac try now.
@adamsilverstein you need to visit Dashboard > Updates, press the "Check Again" button and update the language packs.
#34
in reply to:
↑ 33
;
follow-up:
↓ 35
@
5 years ago
Works, thank you!
Might I ask, out of curiosity, what you did to fix it?
Replying to ramiy:
@leac try now.
#35
in reply to:
↑ 34
;
follow-up:
↓ 36
@
5 years ago
Replying to leac:
Might I ask, out of curiosity, what you did to fix it?
I changed the %1$s %2$s, %3$s @ %4$s:%5$s
translation string. I tested all kind of combinations - with spaces, without spaces, original order, reverse order. In RTL languages we can also use the HTML ‏
entity. There are many solutions. Each has it's own benefits. But also side effects like the one you reported above.
In any case, those are the strings I've updated to fix the issue:
#36
in reply to:
↑ 35
@
5 years ago
Thank you very much for the detailed explanation. And of course for the fix :)
Replying to ramiy:
Replying to leac:
I changed the%1$s %2$s, %3$s @ %4$s:%5$s
translation string. I tested all kind of combinations - with spaces, without spaces, original order, reverse order. In RTL languages we can also use the HTML‏
entity. There are many solutions. Each has it's own benefits. But also side effects like the one you reported above.
In any case, those are the strings I've updated to fix the issue:
#37
@
5 years ago
@ramiy @leac can we close this as resolved? The Gutenberg fix was also merged in https://github.com/WordPress/gutenberg/pull/16375
#39
@
5 years ago
Thanks @ramiy - this is indeed fixed now, but I just want to mention that switching the hours/minutes order in the RTL translation is semantically incorrect. But since this only affects the classic editor, I'm fine with it - though this is something we'd want to share with all the other RTL language teams (Arabic uses the extra space method you've mentioned before, and Farsi doesn't have any "fix" in the translation).
CC @nabilmoqbel @alex-ye @dedidata @man4toman
#40
@
5 years ago
Yes, @adamsilverstein. Joining @ramiy and @yoavf, it's fine by me to close this as resolved.
Thank you all very much.
#41
@
5 years ago
Thanks @yoavf
I'll fix this asap for Farsi(Persian) language.
Update:
Thanks @ramiy but it doesn't fix only by replacing :
with :
, we must remove/replace @
too.
#43
@
5 years ago
It doesn't feel right to reverse the translations particularly because the string has no specific context. Is it possible to use _x()
with this string in the future releases?
Example:
_x( '%1$s %2$s, %3$s @ %4$s:%5$s', 'date-edit' )
#44
@
5 years ago
- Keywords needs-testing fixed-major added
- Milestone changed from 5.3 to 5.2.3
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening this so it can be back-ported to the 5.2 branch, also needs testing to validate if this ticket is good to land in 5.2.3.
This ticket was mentioned in Slack in #core by marybaum. View the logs.
5 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
5 years ago
#47
@
5 years ago
It doesn't feel right to reverse the translations particularly because the string has no specific context. Is it possible to use _x() with this string in the future releases?
Good suggestion, can we open up a follow up ticket to address this?
This ticket was mentioned in Slack in #core by whyisjake. View the logs.
5 years ago
#49
@
5 years ago
- Milestone changed from 5.2.3 to 5.3
This specific issue has been resolved in Gutenberg and will land in core once a major release includes that specific Gutenberg release. I'm re-milestoning this to 5.3 as that's likely when this issue will land in core, though subsequent or related issues can be considered before 5.3 as necessary.
RTl reversed time field order in edit post