Make WordPress Core

Opened 15 months ago

Closed 15 months ago

Last modified 15 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:

Description

If we look at this string and look at the comment: https://translate.wordpress.org/projects/wp/dev/nl-be/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=58766&filters%5Btranslation_id%5D=59297120

We notice this:

Localized time format, see https://www.php.net/manual/datetime.format.php
Time format, see https://www.php.net/manual/datetime.format.php
Comment time format. See https://www.php.net/manual/datetime.format.php
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 https://www.php.net/manual/datetime.format.php
Default time format, see https://www.php.net/manual/datetime.format.php

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
15 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.


15 months ago
#2

  • 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: https://core.trac.wordpress.org/ticket/59947

#3 @swissspidy
15 months ago

#59948 was marked as a duplicate.

@NekoJonez commented on PR #5695:


15 months ago
#4

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:


15 months ago
#6

@NekoJonez Yes. Just this one needs to be added in Gutenberg: https://translate.wordpress.org/projects/wp/dev/nl-be/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=13716800&filters%5Btranslation_id%5D=94748493

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

@swissspidy commented on PR #5695:


15 months ago
#7

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

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

https://github.com/WordPress/gutenberg/blob/a7911582cda6f11d1ebddcd27ccbb82fb86022c5/packages/block-editor/src/components/date-format-picker/index.js#L82-L87

@NekoJonez commented on PR #5695:


15 months ago
#8

Will do that in the near future.

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


15 months ago

@NekoJonez commented on PR #5695:


15 months ago
#11

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:


15 months ago
#12

Awesome, thanks!

#13 @swissspidy
15 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.