-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance/display important dates on search #41301
Enhance/display important dates on search #41301
Conversation
Added "sticky" status for posts on search and listing
Add sticky Label for posts
@sixhours I just pushed a fix. |
Me neither... I'll change "on" to "for" right away... |
Thanks @millerf for taking this one! Some quick notes after testing the posts search.
|
It is intended, we discussed this here. @sixhours thought it was misleading.
Will do
How do you create those ones? 😅 |
Uhm, I think she was referring specifically to the published post status combined with the last modified date. If we change that to read "Published on [published_date]" as I suggested above, I don't think we need the comma.
By toggling the "Pending review" checkbox on the sidebar panel and saving it as pending: |
extraStatusClassName = 'is-trash'; | ||
statusIcon = 'trash'; | ||
const displayedTime = this.getDisplayedTimeForLabel(); | ||
statusText = this.props.translate( 'trashed %(displayedTime)s', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cannot add more comments to the previous discussion, so I'm copying the comments over here to continue it.
@Automattic/i18n or @akirk can confirm, but I think we need to handle both status and date on the same translation. For instance, here
displayScheduleTime
containson [date]
for posts trashed more than a week ago, sotrashed %(displayScheduleTime)s
finally reads astrashed on [date]
. Some languages might need to move the translated "on" part before "trashed" (while leaving the date after). To support those languages, the translatable string should betrashed on [date]
rather thantrashed [datePrefixedWithOn]
.The same applies for the rest of statuses (scheduled for [date], published on [date], draft last modified on [date], ...).
This is quite complex to tackle, as the "on" is not always present (for example : "Published yesterday" vs "Published on Mar, 23 march 2020")
And as translation texts cannot have variables to pass on the status, I would have to have to list all cases that could happen.Also waiting to translators to confirm, but I think the "on" is the beginning of the proposition of time, so it correlates more with the date than the adjective. As in "On 23rd of March, I published, etc,..." But I might be mistaken...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also waiting to translators to confirm, but I think the "on" is the beginning of the proposition of time, so it correlates more with the date than the adjective
Yeah, let's see if @Automattic/i18n or @akirk can jump in. I might be wrong as well, but languages are so different that I wouldn't assume that prepositions are always part of the date in all of them.
4d9b98e
to
6157493
Compare
I took a look at the screenshots and the code and it seems to me we still have a lot of string concats here which should be avoided. In some languages maybe the date needs to be put at the start of the phrase, this makes it impossible. Also it's hard to know if in a translation the date might depend on the rest of the phrase. Since there are not that many possible states, I'd recommend to just write them out:
Where possible, we should go for a label, like with
Using a clock instead of "Last modified" and then the plain specific date or relative date is also an option. But it should only be used for "Last modified" and that date should only be displayed when the post is in the draft stage (resp. pending review). |
Not sure we need a |
Following our discussion about the right place of the
I'll prepare the code for that anyway, but I think we really need some translator to help out here before doing anything 😄 |
In English. You cannot make this assumption for other languages, some languages don't have prepositions. I only know a few but I can well see cases where a relative time needs to come at the beginning of a sentence, while an absolute time needs to be at the end. This is why we should not split sentences and join them through concat. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the latest update, @millerf! I tried to test all the different combinations and it works great overall. I've found two issues, but only one of them is blocking. Please, see below.
Private posts are flagged twice now: with a prefix in the title and with a status label. Fine to address this in a follow-up.
Posts | Pages |
---|---|
![]() |
![]() |
✅Drafts
Posts | Pages |
---|---|
![]() |
![]() |
✅Scheduled
Posts | Pages |
---|---|
![]() |
![]() |
✅Trashed
Posts | Pages |
---|---|
![]() |
![]() |
❌Search
Published date is not displayed for private posts. We'd need to fix this before merging.
Posts | Pages |
---|---|
![]() |
![]() |
} ); | ||
} | ||
return this.props.translate( 'trashed %(displayedTime)s', { | ||
comment: '%(displayedTime)s is when a post or page was trashed', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given absolute/relative dates need to be at a different place for some languages, translators will need to know if this date is relative or absolute. Could you add some extra info in the comments so they can know that we use an absolute date in trashed on/published on/scheduled for/last modified on [date]
and a relative date in trashed/published/last modified [date]
?
@mmtr Thanks a lot for the deep testing. Yesterday I didn't quite finish what I wanted to do, to it is still work-in-progress. Sorry I forgot to mention it! But anyway, I found something interesting:
I didn't have any private post (I was testing with
|
Fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this, @millerf! Experience is much more consistent now ❤️. Didn't find any regression so let's merge this after addressing the couple of very minor comments below.
Nice catch! I'll file an issue so we can fix that server-side once this lands. |
Co-Authored-By: Miguel Torres <miguelmariatorresrojas@gmail.com>
Co-Authored-By: Miguel Torres <miguelmariatorresrojas@gmail.com>
@mmtr I commited your suggestions, I think this can be landed safely now |
Changes proposed in this Pull Request
Based on @sixhours remarks (#41242 (review)), some minor fixes need to be added.
Fixes #41075