WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#7089 closed defect (bug) (duplicate)

Inline comments in POT should be in msgctxt instead

Reported by: leuce Owned by: nbachiyski
Milestone: Priority: normal
Severity: normal Version:
Component: I18N Keywords: i18n comment, translation, l10n, POT, PO, gettext, msgctxt, inline, pipe
Focuses: Cc:

Description

Some of the msgid messages in the wordpress.pot file contains inline comments for the translator. These comments should ideally form part of the commented section of each message. Leaving the comments inline might cause translators to translate the comment if they use a tool that doesn't know to hide these comments from the user.

In the wordpress.pot file, these comments are separated from the translatable text using a pipe character.

Examples of what currently is and what should ideally be:

==

#: wp-admin/edit-comments.php:99
msgid "Approved|plural"
msgstr ""

#: wp-admin/edit-comments.php:99
msgctxt "plural"
msgid "Approved"
msgstr ""

==

#: wp-admin/edit-pages.php:42 wp-admin/includes/post.php:481
msgid "Drafts|manage posts header"
msgstr ""

#: wp-admin/edit-pages.php:42 wp-admin/includes/post.php:481
msgctxt "manage posts header"
msgid "Drafts"
msgstr ""

==

#: wp-admin/edit-pages.php:74
#, php-format
msgid ""
"%1$s%2$s%3$s|You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}"
msgstr ""

#: wp-admin/edit-pages.php:74
#, php-format
msgctxt ""
"You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}"
msgid "%1$s%2$s%3$s"
msgstr ""

==

You can easily find these in the wordpress.pot file by searching for a pipe (|) character, but I've extracted all of them from wordpress.pot, to illustrate which of them need the change. Some of them might use comprehensive rewriting, such as this one:

#: wp-includes/locale.php:186
msgid ""
"number_format_decimal_point|$dec_point argument for http://php.net/"
"number_format, default is ."
msgstr ""

...which is probably rather meanless to a poor translator. I'll be willing to write suggested changes for these, but I'm not skilled to edit the actual sources from which the POT file is generated.

Thanks

Attachments (1)

wordpress_pot_pipes.zip (1.3 KB) - added by leuce 7 years ago.
All the messages from wordpress.pot relevant to this bug

Download all attachments as: .zip

Change History (5)

@leuce7 years ago

All the messages from wordpress.pot relevant to this bug

comment:1 @jacobsantos7 years ago

From my understanding, the pipes are the context and are needed for WordPress to keep the context. Without it, you would difficultly with different areas in WordPress which have different meaning on where it is used.

I would suggest this be marked as 'invalid' since this is an intentional feature and would cause regressions. I would also suggest that the translator Codex page be updated with the _c() translated string context function information.

comment:2 @ryan7 years ago

We didn't use msgctxt because of lack of support for it in various gettext tools. I haven't looked lately to see if poedit and others now support it.

comment:3 @nbachiyski7 years ago

  • Keywords i18n added
  • Milestone changed from 2.7 to 2.6
  • Owner changed from anonymous to nbachiyski

In the past, we preferred the pipe method, because the current then poEdit versions stripped the msgctxt lines from the PO(T) files.

Now poEdit handles them well and for the next versions we will use msgctxt where appropriate and extracted comments, where we have used the pipe only for clarifications.

comment:4 @nbachiyski7 years ago

  • Milestone 2.9 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #9112.

Note: See TracTickets for help on using tickets.