Making WordPress.org

Opened 20 months ago

Last modified 18 months ago

#6922 new defect (bug)

Translate: missing translators comments from Gutenberg

Reported by: afercia's profile afercia Owned by:
Milestone: Priority: normal
Component: Translate Site & Plugins Keywords:
Cc:

Description

Looks like some translator comments from the Gutenberg codebase aren't picked up They don't show up in the translate user interface.

The only reason I can think of is because od the curly braces {} but that's just a guess.

A few examples:

Good example:
The comment of the string return __( 'Publishing…' ); here does show up.
See the string on translate here.

Bad example:
The comment of the strings const label = isPending ? __( 'Save as pending' ) : __( 'Save draft' ) here do not show up.
See the strings on translate here and here.

Bad example:
The comment of the string label={ __( 'Details' ) } here does not show up (actually, it shows another comment from wp-includes/media-template.php).
See the string on translate here.

Bad example:
The comment of the string label={ __( 'Undo' ) } here does not show up (actually, it shows another comment from wp-admin/edit-comments.php because of strings concatenation; that's an issue but it's unrelated to the missing comment).
See the string on translate here.

Change History (2)

#1 @aristath
20 months ago

Did some quick investigation, looking at the way these files get compiled.

The code in gutenberg/packages/editor/src/components/table-of-contents/index.js contains the Details string like this:

	aria-haspopup="true"
	/* translators: button label text should, if possible, be under 16 characters. */
	label={ __( 'Details' ) }

However, when the files get compiled, the result looks like this:

        "aria-haspopup": "true"
        /* translators: button label text should, if possible, be under 16 characters. */
        ,
        label: (0,external_wp_i18n_namespaceObject.__)('Details'),

There's an extra line between the comment and the actual string. In this case that line contains a comma, but in other cases I looked at it was a plain blank line. Strings that don't have any additional lines between the comment and the string seem to have the translators comment properly used, while strings that have additional lines between the comment and the string don't - regardless of whether that line is a plain blank line or a comma etc.

Note: See TracTickets for help on using tickets.