Bug 818768

Summary: [l10n] publican update_po badly merges new strings
Product: [Community] Publican Reporter: Raphaël Hertzog <raphael>
Component: publicanAssignee: Jeff Fearn 🐞 <jfearn>
Status: CLOSED CURRENTRELEASE QA Contact: tools-bugs <tools-bugs>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.0CC: hpeters, mhideo, rlandman+disabled
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-31 03:11:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to use the entry from POT instead of a completely new entry none

Description Raphaël Hertzog 2012-05-03 22:20:26 UTC
Created attachment 581979 [details]
Patch to use the entry from POT instead of a completely new entry

Description of problem:

Add some new strings to a document, update POT files and then update the PO files. Completely new strings will end up in the PO files quoted twice:

msgid "\"Creative Commons License Notice:\""
msgstr ""

instead of the expected:

msgid "Creative Commons License Notice:"
msgstr ""

Those strings also lack the automatic comments (#. Tag: para) and the flags. 

Everything is related to this block of code in Translate.pm:

        if ( !$matched ) {
            my $po = new Locale::PO( -msgid => $pot_id, -msgstr => '' );
            $po_hash->{$pot_id} = $po;
            push( @out_arry, $po );
        }

At a first glance, you should just integrate the unmodified POT entry as per the attached patch, i.e. get this:

        if ( !$matched ) {
            push( @out_arry, $pot );
        }

This is a problem affecting publican 3.0 and it should definitely be fixed before release.

Comment 1 Jeff Fearn 🐞 2012-05-03 22:55:23 UTC
Thanks, excellent assessment and correct solution!

To ssh://git.fedorahosted.org/git/publican.git
   85436ed..d608d3e  master -> master

Comment 2 Michael Hideo 2012-06-08 02:01:02 UTC
(In reply to comment #0)
> Created attachment 581979 [details]
> Patch to use the entry from POT instead of a completely new entry
> 
> Description of problem:
> 
> Add some new strings to a document, update POT files and then update the PO
> files. Completely new strings will end up in the PO files quoted twice:
> 
> msgid "\"Creative Commons License Notice:\""
> msgstr ""
> 
> instead of the expected:
> 
> msgid "Creative Commons License Notice:"
> msgstr ""
> 
> Those strings also lack the automatic comments (#. Tag: para) and the flags. 
> 
> Everything is related to this block of code in Translate.pm:
> 
>         if ( !$matched ) {
>             my $po = new Locale::PO( -msgid => $pot_id, -msgstr => '' );
>             $po_hash->{$pot_id} = $po;
>             push( @out_arry, $po );
>         }
> 
> At a first glance, you should just integrate the unmodified POT entry as per
> the attached patch, i.e. get this:
> 
>         if ( !$matched ) {
>             push( @out_arry, $pot );
>         }
> 
> This is a problem affecting publican 3.0 and it should definitely be fixed
> before release.

follow steps above.

Comment 3 Hedda Peters 2012-06-14 04:21:21 UTC
Verified. 

New content added to an .xml file is represented as expected in the newly generated .po file, with correct quotes and comments.