Make WordPress Core

Opened 6 months ago

Closed 6 months ago

Last modified 6 months ago

#59947 closed enhancement (fixed)

Comment overkill for time string

Reported by: nekojonez's profile NekoJonez Owned by: swissspidy's profile swissspidy
Milestone: 6.5 Priority: normal
Severity: minor Version:
Component: I18N Keywords: has-patch
Focuses: Cc:


If we look at this string and look at the comment:

We notice this:

Localized time format, see
Time format, see
Comment time format. See
1: Name of most recent post author, 2: Post edited date, 3: Post edited time.
1: Post edited date, 2: Post edited time.
1: Post creation date, 2: Post creation time.
Post time format. See
Default time format, see

Since this also appears in the editor, we get irrelevant comments for this string. It also causes that we get the same link 5 times.
-> Maybe this is something for GlotPress... But, I think that comments like these should look better. Since, the fact that there are placeholders in the other strings and what they mean isn't needed for translators when translating just the time string. I think we should just see that link & that the string is also used to show for the localized time, time, comment time, post time & default time format. Besides, why would a locale or why would we use two different time formats in WordPress? Like one written like "g:i A" and in other parts of the interface use "H:i"...? I mean, it doesn't make any sense and isn't user friendly in my personal eyes.

Change History (14)

#1 @swissspidy
6 months ago

  • Component changed from Date/Time to I18N
  • Focuses ui docs removed
  • Keywords needs-patch added
  • Milestone changed from Awaiting Review to 6.5
  • Owner set to swissspidy
  • Severity changed from normal to minor
  • Status changed from new to assigned

Heya, thanks for your report. This is an issue with how the code is formatted & how the strings are extracted for translations. It causes the wrong comments to be associated and ultimately displayed in GlotPress. We can address this by improving the code formatting.

This ticket was mentioned in PR #5695 on WordPress/wordpress-develop by @swissspidy.

6 months ago

  • Keywords has-patch added; needs-patch removed

Disambiguate usage of translator comments for sprintf() calls with multiple translated strings.
Writing the code on multiple lines makes it clearer which string the comment is intended for.

Trac ticket:

#3 @swissspidy
6 months ago

#59948 was marked as a duplicate.

@NekoJonez commented on PR #5695:

6 months ago

Will this PR fix the fact that not in all datetime strings... we get a comment to the PHP manual?

@NekoJonez commented on PR #5695:

6 months ago

@NekoJonez Yes. Just this one needs to be added in Gutenberg:

Do I need to open a Gutenberg issue in their GitHub or ...?

@swissspidy commented on PR #5695:

6 months ago

If you'd like to open a PR there, feel free!

It basically needs a separate comment between each of those lines:

@NekoJonez commented on PR #5695:

6 months ago

Will do that in the near future.

This ticket was mentioned in Slack in #polyglots by nekojonez. View the logs.

6 months ago

@NekoJonez commented on PR #5695:

6 months ago

I tried to make the Gutenberg PR. Curious if I did it right.
After that, it might be ready for commit no?

@swissspidy commented on PR #5695:

6 months ago

Awesome, thanks!

#13 @swissspidy
6 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 57136:

I18N: Improve translator comments for strings containing date formats.

Adds translator comments where absent and changes code style so that
comments are attached to the right strings during string extraction.

Props NekoJonez.
Fixes #59947

Note: See TracTickets for help on using tickets.