Ticket #7089 (new defect)

Opened 6 months ago

Last modified 6 months ago

Inline comments in POT should be in msgctxt instead

Reported by: leuce Assigned to: nbachiyski
Priority: normal Milestone: 2.9
Component: i18n Version:
Severity: normal Keywords: i18n comment, translation, l10n, POT, PO, gettext, msgctxt, inline, pipe
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

wordpress_pot_pipes.zip (1.3 kB) - added by leuce on 06/04/08 08:54:20.
All the messages from wordpress.pot relevant to this bug

Change History

06/04/08 08:54:20 changed by leuce

  • attachment wordpress_pot_pipes.zip added.

All the messages from wordpress.pot relevant to this bug

06/04/08 12:24:36 changed by jacobsantos

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.

06/04/08 20:24:14 changed by ryan

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.

06/04/08 21:07:52 changed by nbachiyski

  • keywords changed from comment, translation, l10n, POT, PO, gettext, msgctxt, inline, pipe to i18n comment, translation, l10n, POT, PO, gettext, msgctxt, inline, pipe.
  • owner changed from anonymous to nbachiyski.
  • milestone changed from 2.7 to 2.6.

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.