Page MenuHomePhabricator

Empty (but existing) msgctxt isn't handled correctly in PO file export
Closed, ResolvedPublic

Description

Author: lasse.liehu

Description:
Steps to reproduce:

  1. Import a PO file with for example the following messages (that are in KDE's kdelibs/solid_qt file):

msgid "%1 TiB"
msgstr "%1 TiB"

msgid "%1 TiB"
msgctxt ""
msgstr "%1 TiB"

  1. Export it

Actual results:

In the exported file it becomes like this:

msgid "%1 TiB"
msgstr "%1 TiB"

msgid "%1 TiB"
msgstr "%1 TiB"

And then gettext gives errors about duplicate definitions of the same message.

Expected results:

The empty msgctxt is preserved and export it's differentiated from the message not having a msgctxt.


Version: master
Severity: normal

Details

Reference
bz43953

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:13 AM
bzimport set Reference to bz43953.

You need to provide a little extra information. Steps to reproduce and gettext file headers with at least a few keys need to be known.

Translate is fully dependent on the value of msgctxt for it's offline file format, which has nothing to do with the final gettext format. msgctxt stores the key that allows Translate match a translation to an internal key.

The final gettext files can only be exported using the export.php script, and the source files from version control cannot be imported through Special:ImportTranslations.

See https://www.mediawiki.org/wiki/Help:Extension:Translate/Off-line_translation for offline translation documentation.

This is not about off-line translation.

lasse.liehu wrote:

OK, so with import I meant configuring a message group for the source files and then processing the changes and importing the existing translations. I followed steps described at http://www.mediawiki.org/wiki/Help:Extension:Translate/Group_configuration and http://www.mediawiki.org/wiki/Help:Extension:Translate/Group_management

An example PO file with its corresponding POT file is attached.

With export I meant using the "Export in native format" option on the export page of the message group (visualized as the Export tab). Or using export.php.

lasse.liehu wrote:

Example PO file

Attached:

lasse.liehu wrote:

Example POT file

Attached: