From f638edf6c4ca2f66c97cd3614ad2acb0e1e226d4 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 17 Jan 2009 21:22:39 +0000 Subject: [PATCH] Display the translation percentage of the pre-merge po file, not the post merge. Otherwise people might be led to think that the file is fully translated, but really they need to commit the merge result first. --- wwwtools/nls-status-table | 13 +++++++++---- wwwtools/pg-make-po | 4 +++- wwwtools/update-nls-www | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/wwwtools/nls-status-table b/wwwtools/nls-status-table index fdc5bfe..3410973 100755 --- a/wwwtools/nls-status-table +++ b/wwwtools/nls-status-table @@ -40,12 +40,17 @@ foreach (@ARGV) { next; }; - /(\w+)-(\w+).po(\.new)?/ || next; + /(\w+)-(\w+).po/ || next; my $catalogname = $1; my $lang = $2; - $new->{$catalogname}{$lang} = 1 if $3; - my $tmp = `LC_ALL=C msgfmt -o /dev/null -v $_ 2>&1`; + my $tmp; + if (-e "$_.old") { + $tmp = `LC_ALL=C msgfmt -o /dev/null -v $_.old 2>&1`; + } else { + $tmp = `LC_ALL=C msgfmt -o /dev/null -v $_ 2>&1`; + $new->{$catalogname}{$lang} = 1; + } $tmp =~ /(\d+) translated/ and $everything->{"$catalogname"}{"$lang"} = $1; if (-f "$_.err") { $errors->{"$catalogname"}{"$lang"} = 1; @@ -106,7 +111,7 @@ foreach my $catalog (sort @catalogs) { push @{$langavg{"$lang"}}, $pct; push @catavg, $pct; } else { - printf "%.0f", $pct; + printf "%.0f", $pct; } if ($errors->{"$catalog"}{"$lang"}) { diff --git a/wwwtools/pg-make-po b/wwwtools/pg-make-po index 004e905..6654174 100755 --- a/wwwtools/pg-make-po +++ b/wwwtools/pg-make-po @@ -70,15 +70,17 @@ foreach (@ARGV) { if (! -f "$dirname/po/$lang.po.new") { # merge failed, proceed with old file system("cp $dirname/po/$lang.po $outdir/$catalogname-$lang.po") if (-f "$dirname/po/$lang.po"); + system("cp $dirname/po/$lang.po $outdir/$catalogname-$lang.po.old") if (-f "$dirname/po/$lang.po"); } elsif (-f "$dirname/po/$lang.po") { # existing po file merged system("cp $dirname/po/$lang.po.new $outdir/$catalogname-$lang.po"); + system("cp $dirname/po/$lang.po $outdir/$catalogname-$lang.po.old"); if (system("$msgfmt -o /dev/null -v -c $outdir/$catalogname-$lang.po >/dev/null 2>&1") != 0) { system("$msgfmt -o /dev/null -v -c $outdir/$catalogname-$lang.po 2>$outdir/$catalogname-$lang.po.err 1>/dev/null"); } } else { # nonexisting po file merged - system("cp $dirname/po/$lang.po.new $outdir/$catalogname-$lang.po.new"); + system("cp $dirname/po/$lang.po.new $outdir/$catalogname-$lang.po"); } } # foreach $lang } # foreach @ARGV diff --git a/wwwtools/update-nls-www b/wwwtools/update-nls-www index bc87cd6..769c586 100755 --- a/wwwtools/update-nls-www +++ b/wwwtools/update-nls-www @@ -56,7 +56,7 @@ for branch in $active_branches; do files=`find $PGSRC -name nls.mk` $MYDIR/pg-make-po -o $WEBDIR/po-$branch -v $branch $files - (cd $WEBDIR/po-$branch && $MYDIR/nls-status-table -U po-$branch *.pot *.po *.po.new >$WEBDIR/table-$branch.html) + (cd $WEBDIR/po-$branch && $MYDIR/nls-status-table -U po-$branch *.pot *.po >$WEBDIR/table-$branch.html) # $MYDIR/pg-make-conflicts $branch $MYDIR $WEBDIR -- 2.39.5