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

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

Comments

@tg29359
Copy link

@tg29359 tg29359 commented Nov 3, 2016

See https://core.trac.wordpress.org/ticket/38620#comment:5.
The sample of the problem:
http://kabanenoimina.x0.com/223/#comments

@ocean90
Copy link
Member

@ocean90 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
Copy link
Member

@ocean90 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
Copy link
Member

@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
@toolstack
Copy link
Contributor

@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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants