[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to spot msgid changes (was Re: Release notes: String freeze)



On Mon, Feb 09, 2009 at 12:27:15AM +0000, W. Martin Borgert wrote:
> Translators: If nobody objects I ask you to finish translations
> until Thursday, 2009-02-12 23:59 UTC. Not much time, sorry.

For those translators that find it difficult to find the changes in a given
msgid the attached perl snippet might be useful. 

How to use:

If you run po4a using --previous (the new Makefile will do this if your po4a
version supports it) you will get these type of content in the PO file:

#| msgid ""
#| "Any package installation operation must be run with superuser privileges,
"
#| "so either login as <literal>root</literal> or use <command>su</command> "
#| "or <command>sudo</command> to gain the necessary access rights."
msgid ""
"Any package installation operation must be run with superuser privileges, so "
"either log in as <literal>root</literal> or use <command>su</command> or " 
"<command>sudo</command> to gain the necessary access rights."

Pasting this to the standard input of the attached perl script will reveal
the difference (using 'wdiff', which you need to have installed):

======================================================================
 [-login-] {+log in+}
======================================================================

Sometimes those are difficult to spot to the untrained eye :)

Regards

Javier

#!/usr/bin/perl -w
# Quick and dirty script to compare two msgids (when using po4a with
# --previous) with wdiff to find the differences between them

my $file1="diff1";
my $file2="diff2";

open (my $DIFF1, ">$file1") || die ("Cannot open $file1: $!");
open (my $DIFF2, ">$file2") || die ("Cannot open $file2: $!");

my $fileh="";
while ($line = <STDIN>) {
    $fileh="";
    chomp $line;
    $file = $DIFF1 if ( $line =~ /^\#\|/ ) ;
    $file = $DIFF2 if ( $line =~ /^"/ ) ;
    $line =~ s/^\#\| //;
    $line =~ s/^"//;
    $line =~ s/"$//;
    print $file $line if $line ne 'msgid "';
}

close $DIFF1; close $DIFF2;

exec ("wdiff -3 $file1 $file2 | less");

exit;

Attachment: signature.asc
Description: Digital signature


Reply to: