[Debian-l10n-commits] dl10n branch master updated. ba847b8145f1727c524476ec96eaff182d808056

David Prévot taffit at alioth.debian.org
Tue Jul 9 14:40:22 UTC 2013


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "dl10n".

The branch, master has been updated
       via  ba847b8145f1727c524476ec96eaff182d808056 (commit)
       via  00f7926e49b47e8e9a15a4d268c8c8c7fb046d94 (commit)
       via  fe1a717fe82166efc02ab006b65362cba6ea831b (commit)
      from  0fc303d5c8afe1b858266a8cf0445384deaad4e3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------

http://anonscm.debian.org/gitweb/?p=debian-l10n/dl10n.git;a=commitdiff;h=ba847b8145f1727c524476ec96eaff182d808056

commit ba847b8145f1727c524476ec96eaff182d808056
Author: David Prévot <taffit at debian.org>
Date:   Tue Jul 9 10:38:45 2013 -0400

    s/+/plus/ in anchors


http://anonscm.debian.org/gitweb/?p=debian-l10n/dl10n.git;a=commitdiff;h=00f7926e49b47e8e9a15a4d268c8c8c7fb046d94

commit 00f7926e49b47e8e9a15a4d268c8c8c7fb046d94
Author: David Prévot <taffit at debian.org>
Date:   Tue Jul 9 10:32:50 2013 -0400

    Avoid (almost) empty columns
    
    No need to display N columns if there is only one language
    per column (probably a different path per language).
    Delete empty columns (only POT).


http://anonscm.debian.org/gitweb/?p=debian-l10n/dl10n.git;a=commitdiff;h=fe1a717fe82166efc02ab006b65362cba6ea831b

commit fe1a717fe82166efc02ab006b65362cba6ea831b
Author: David Prévot <taffit at debian.org>
Date:   Mon Jul 8 23:11:29 2013 -0400

    Display more than one PO file if needed
    
    Closes: #662886

-----------------------------------------------------------------------

Summary of changes:
 dl10n-pts |  143 ++++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 114 insertions(+), 29 deletions(-)

diff --git a/dl10n-pts b/dl10n-pts
index b04f755..9d7451d 100755
--- a/dl10n-pts
+++ b/dl10n-pts
@@ -132,29 +132,63 @@ foreach my $pkg ($data->list_packages()) {
         my $has_part="has_$part";
         if ($data->$has_part($pkg)) {
             foreach my $line (@{$data->$part($pkg)}){
-                my ($pofile, $lang, $stat) = @{$line};
+                my ($pofile, $lang, $stat, $path) = @{$line};
+		$path =~ s/^(.*)\/.*$/$1/;
+		$path =~ s/^$lang\///;
+		$path =~ s/\/$lang$//;
+		$path =~ s/\/$lang\///;
                 if (defined $lang and length $lang) {
-                    $score{$pkg}{$part}{$lang} =
-                        add_stat($stat, $score{$pkg}{$part}{$lang});
+                    $score{$pkg}{$part}{$path}{$lang} =
+                        add_stat($stat, $score{$pkg}{$part}{$path}{$lang});
                     $langs{$pkg}{$lang} = 1;
                 }
             }
 
-            unless (defined $score{$pkg}{$part}{'_'}) {
+	    # No need to display N columns if there is only one language
+	    # per column (probably a different path per language).
+	    my $size = keys %{$score{$pkg}{$part}};
+	    my $nblang = keys %{$langs{$pkg}};
+	    if ($size > 1 and $nblang > 1) {
+		my $split = 0;
+		foreach my $path (keys %{$score{$pkg}{$part}}) {
+		    $size = keys(%{$score{$pkg}{$part}{$path}});
+		    $split = 1 if $size > 1;
+		    # Delete empty columns (only POT)
+		    if ($size == 1) {
+			foreach my $lang (keys %{$score{$pkg}{$part}{$path}}) {
+			    delete $score{$pkg}{$part}{$path} if ($lang eq '_') ;
+			}
+		    }
+
+		}
+		if ($split == 0) {
+		    foreach my $path (keys %{$score{$pkg}{$part}}) {
+			foreach my $lang (keys %{$score{$pkg}{$part}{$path}}) {
+			    $score{$pkg}{$part}{'none'}{$lang} = $score{$pkg}{$part}{$path}{$lang};
+			    delete $score{$pkg}{$part}{$path};
+			}
+		    }
+		}
+	    }
+
+
+	    foreach my $path (keys %{$score{$pkg}{$part}}) {
+	      unless (defined $score{$pkg}{$part}{$path}{'_'}) {
                 # If there is no POT file, try to find the number of strings
                 # from the other POs. This is usually a sign for non up to date
                 # PO files, so the number of strings in the PO files may vary.
                 # I choose to take the greatest number.
                 my $t = 0;
                 foreach my $lang (keys %{$langs{$pkg}}) {
-                    if (    (defined $score{$pkg}{$part}{$lang})
-                        and (tot($score{$pkg}{$part}{$lang}) > $t)) {
-                        $t = tot($score{$pkg}{$part}{$lang});
+                    if (    (defined $score{$pkg}{$part}{$path}{$lang})
+                        and (tot($score{$pkg}{$part}{$path}{$lang}) > $t)) {
+                        $t = tot($score{$pkg}{$part}{$path}{$lang});
                     }
                 }
-                $score{$pkg}{$part}{'__'} = "0t0f".$t."u";
-            } else {
-                $score{$pkg}{$part}{'__'} = $score{$pkg}{$part}{'_'};
+                $score{$pkg}{$part}{$path}{'__'} = "0t0f".$t."u";
+	      } else {
+                $score{$pkg}{$part}{$path}{'__'} = $score{$pkg}{$part}{$path}{'_'};
+	      }
             }
         }
     }
@@ -171,21 +205,23 @@ foreach my $pkg (keys %score) {
     foreach my $lang (keys %{$langs{$pkg}}) {
         if ($lang ne "_" and $lang ne "__") {
             foreach my $part (keys %{$score{$pkg}}) {
-                next unless defined $score{$pkg}{$part}{$lang};
-                if ($part eq "podebconf") {
+	      foreach my $path (keys %{$score{$pkg}{$part}}) {
+                next unless defined $score{$pkg}{$part}{$path}{$lang};
+                if ($part eq "podebconf" and defined $score{$pkg}{$part}{$path}{$lang}) {
                     $global_score{$pkg}{debian} =
-                        add_stat ($score{$pkg}{$part}{$lang},
+                        add_stat ($score{$pkg}{$part}{$path}{$lang},
                                   $global_score{$pkg}{debian});
-                } elsif ($part eq "po") {
+                } elsif ($part eq "po" and defined $score{$pkg}{$part}{$path}{$lang}) {
                     # FIXME: use heuristics or control field
                     $global_score{$pkg}{nondebian} =
-                        add_stat ($score{$pkg}{$part}{$lang},
+                        add_stat ($score{$pkg}{$part}{$path}{$lang},
                                   $global_score{$pkg}{nondebian});
-                } elsif ($part eq "po4a") {
+                } elsif ($part eq "po4a" and defined $score{$pkg}{$part}{$path}{$lang}) {
                     $global_score{$pkg}{debian} =
-                        add_stat ($score{$pkg}{$part}{$lang},
+                        add_stat ($score{$pkg}{$part}{$path}{$lang},
                                   $global_score{$pkg}{debian});
                 }
+	      }
             }
         }
     }
@@ -254,8 +290,8 @@ EOF
         my $msg = "";
         # Check if there are no up to date languages
         my $uptodate = 0;
-        foreach my $lang (keys %{$score{$pkg}{"podebconf"}}) {
-            if (    ($score{$pkg}{"podebconf"}{$lang} =~ m/^([0-9]+)t0f0u$/)
+        foreach my $lang (keys %{$score{$pkg}{"podebconf"}{'debian/po'}}) {
+            if (    ($score{$pkg}{"podebconf"}{'debian/po'}{$lang} =~ m/^([0-9]+)t0f0u$/)
                 and ($1 ne "0")) {
                 $uptodate = 1;
             }
@@ -269,7 +305,7 @@ EOF
     </div>
 EOF
         }
-        my $languages = scalar (keys %{$score{$pkg}{"podebconf"}}) - 2;
+        my $languages = scalar (keys %{$score{$pkg}{"podebconf"}{'debian/po'}}) - 2;
         if ($languages < 5) {
             # There are at least 5 very active translation teams:
             # es,de,pt,sv,cs
@@ -314,23 +350,72 @@ EOF
     <h1>Translation status of package $pkg</h1>
     <table>
 EOF
+    my ($sizepo,$sizepo4a) = (0,0);
     print PKGSTATUS "<tr><th>Language</th>";
     print PKGSTATUS "<th>podebconf</th>"
         if defined $score{$pkg}{"podebconf"};
-    print PKGSTATUS "<th>po</th>"
-        if defined $score{$pkg}{"po"};
-    print PKGSTATUS "<th>po4a</th>"
-        if defined $score{$pkg}{"po4a"};
+    if (defined $score{$pkg}{"po"}) {
+	$sizepo = keys(%{$score{$pkg}{"po"}});
+	print PKGSTATUS '<th';
+	print PKGSTATUS " colspan=\"$sizepo\""
+	    if $sizepo > 1;
+	print PKGSTATUS '>po</th>';
+    }
+    if (defined $score{$pkg}{"po4a"}) {
+	$sizepo4a = keys(%{$score{$pkg}{"po4a"}});
+	print PKGSTATUS '<th';
+	print PKGSTATUS " colspan=\"$sizepo4a\""
+	    if $sizepo4a > 1;
+	print PKGSTATUS '>po4a</th>';
+    }
     print PKGSTATUS "</tr>\n";
+
+    if ($sizepo > 1 or $sizepo4a > 1) {
+	print PKGSTATUS "<tr><th></th>";
+	print PKGSTATUS "<th></th>"
+	    if defined $score{$pkg}{"podebconf"};
+	if (defined $score{$pkg}{"po"}) {
+	    if ($sizepo > 1) {
+		foreach my $path (sort keys %{$score{$pkg}{"po"}}) {
+		    print PKGSTATUS "<th>$path</th>";
+		}
+	    }
+	    else {
+		print PKGSTATUS "<th></th>";
+	    }
+        }
+	if (defined $score{$pkg}{"po4a"}) {
+	    if ($sizepo4a > 1) {
+		foreach my $path (sort keys %{$score{$pkg}{"po4a"}}) {
+		    print PKGSTATUS "<th>$path</th>";
+	        }
+	    }
+	    else {
+		print PKGSTATUS "<th></th>";
+	    }
+	}
+	print PKGSTATUS "</tr>\n";
+    }
+
+    # avoid deprecated characters in anchors
+    my $pkgid = $pkg;
+    $pkgid =~ s/\+/plus/;
+
     foreach my $lang (sort keys %{$langs{$pkg}}) {
         if ($lang ne "_" and $lang ne "__") {
             print PKGSTATUS "      <tr><td align=\"right\">$lang</td>";
-            print PKGSTATUS '<td><a href="'.$WEBSITE."po-debconf/$lang#$pkg\">".graph_stats($score{$pkg}{"podebconf"}{$lang}).'</a></td>'
+            print PKGSTATUS '<td><a href="'.$WEBSITE."po-debconf/$lang#$pkgid\">".graph_stats($score{$pkg}{"podebconf"}{'debian/po'}{$lang}).'</a></td>'
                 if defined $score{$pkg}{"podebconf"};
-            print PKGSTATUS '<td><a href="'.$WEBSITE."po/$lang#$pkg\">".graph_stats($score{$pkg}{"po"}{$lang}).'</a></td>'
-                if defined $score{$pkg}{"po"};
-            print PKGSTATUS '<td><a href="'.$WEBSITE."po4a/$lang#$pkg\">".graph_stats($score{$pkg}{"po4a"}{$lang}).'</a></td>'
-                if defined $score{$pkg}{"po4a"};
+	    if (defined $score{$pkg}{"po"}) {
+		foreach my $path (sort keys %{$score{$pkg}{"po"}}) {
+		    print PKGSTATUS '<td><a href="'.$WEBSITE."po/$lang#$pkgid\">".graph_stats($score{$pkg}{"po"}{$path}{$lang}).'</a></td>';
+		}
+	    }
+	    if (defined $score{$pkg}{"po4a"}) {
+		foreach my $path (sort keys %{$score{$pkg}{"po4a"}}) {
+		    print PKGSTATUS '<td><a href="'.$WEBSITE."po4a/$lang#$pkgid\">".graph_stats($score{$pkg}{"po4a"}{$path}{$lang}).'</a></td>';
+	        }
+	    }
             print PKGSTATUS "</tr>\n";
         }
     }
-----------------------------------------------------------------------


hooks/post-receive
-- 
dl10n



More information about the Debian-l10n-commits mailing list