Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#45628 closed defect (bug) (reported-upstream)

Translator comments showing up incorrectly for certain cases

Reported by: otto42's profile Otto42 Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: I18N Keywords:
Focuses: Cc:

Description

Example (non-specific to 5.0, although it only started showing up after the 5.0 release):

https://build.trac.wordpress.org/browser/branches/5.0/wp-includes/class-wp-locale.php?marks=167#L167

https://build.trac.wordpress.org/browser/branches/5.0/wp-includes/class-wp-locale.php?marks=195#L195

The first one has this line, which works fine.

$this->month['12'] = /* translators: month name */ __( 'December' );

The second one has this:

$this->month_abbrev[ __( 'December' ) ]  = /* translators: three-letter abbreviation of the month */ _x( 'Dec', 'December abbreviation' );

Now, this may be in the build tools, or in recent changes to glotpress, but in the translate site, this particular entry for "December" ends up showing up with this comment:

Comment: translators: month name translators: three-letter abbreviation of the month

Now, this is obviously confusing. In at least two cases, UK and IT, the translators ended up translating it as the abbreviation. This lead to users having their date displays suddenly change from full months to abbreviated months.

https://wordpress.org/support/topic/wp-5-does-not-recognize-the-date-format-l-j-f-y/

Changing the translations back fixes the problem, but this file should probably be better organized to make sure that the translator comment goes onto the correct string, or the build tools should be modified to make the same happen.

Change History (3)

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


6 years ago

#2 @ocean90
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

This is a known issue and tracked in https://github.com/wp-cli/i18n-command/issues/96.

#3 @garrett-eclipse
6 years ago

@ocean90 thanks for the reference I was just taking a look at this.

I'm curious if in core we add a comment specific to the first string on the line if the parser would associate the two strings properly? If so I can put a patch in for 5.0.x to address the issue in core.

Current string;
$this->month_abbrev[ __( 'December' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Dec', 'December abbreviation' );

Suggestion;
$this->month_abbrev[ /* translators: month name */ __( 'December' ) ] = /* translators: three-letter abbreviation of the month */ _x( 'Dec', 'December abbreviation' );

Let me know if that mitigates the upstream issue and I'll put a patch together.

Thanks

Last edited 6 years ago by garrett-eclipse (previous) (diff)
Note: See TracTickets for help on using tickets.