Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something is wrong with exporting .mo when original string has msgid_plural and translation has only one msgstr #594

tg29359 opened this issue Nov 3, 2016 · 4 comments


Copy link

@tg29359 tg29359 commented Nov 3, 2016

The sample of the problem:

Copy link

@ocean90 ocean90 commented Nov 3, 2016


Steps to reproduce:

Expected: The command runs without errors and the PO file is complete.
Actual: There is an error read-mo.c:249: invalid multibyte sequence and some translations are missing in the PO file.

Copy link

@ocean90 ocean90 commented Nov 3, 2016

Simpler test case:

require '/path/to/wp-includes/pomo/mo.php';

$mo = new MO();
$mo->add_entry( new Translation_Entry( [
    'singular' => 'Page Layout',
    'translations' => [
] ) );

$mo->export_to_file( '' );

$ msgunfmt -o test.po will produce the same error as above.

@ocean90 ocean90 added this to the 2.3 milestone Nov 3, 2016
Copy link

@ocean90 ocean90 commented Nov 3, 2016

Okay, that's a major issue and was introduced in 1a9e695.

Adding $mo->set_header( 'Content-Type', 'text/plain; charset=UTF-8' ); to the test script generates a correct PO file.

MO files currently don't have any headers like the required Content-Type or Plural-Forms.

@ocean90 ocean90 modified the milestones: 2.2.1, 2.3 Nov 3, 2016
Copy link

@toolstack toolstack commented Nov 3, 2016

Easy enough to fix, we can simply remove the override of the header output for mo's.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants