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

Closed
tg29359 opened this Issue Nov 3, 2016 · 4 comments

Comments

Projects
None yet
3 participants

@ocean90 ocean90 added the bug label Nov 3, 2016

@ocean90

This comment has been minimized.

Copy link
Member

ocean90 commented Nov 3, 2016

Confirmed.

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.

@ocean90

This comment has been minimized.

Copy link
Member

ocean90 commented Nov 3, 2016

Simpler test case:

<?php
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( 'test.mo' );

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

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

@ocean90

This comment has been minimized.

Copy link
Member

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

@toolstack

This comment has been minimized.

Copy link
Contributor

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