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

Changer '_' en 'pot' sur les pages webs de stats de po://



On Tue, Jan 18, 2005 at 09:58:56PM +0100, Denis Barbier wrote:
> On Tue, Jan 18, 2005 at 11:16:55AM +0100, Martin Quinson wrote:
> [...]
> > Mais pourtant, on parle du fichier po, pas de po-debconf. dl10n indique 6
> > chaines à traduire, mais d'apres http://www.nl.debian.org/intl/l10n/po/_
> > c'est le fichier testset/debconf/debian/po/templates.pot 
> 
> Si quelqu'un se demande quoi faire pour aider, il/elle peut modifier les
> scripts de génération des pages pour remplacer
>   http://www.nl.debian.org/intl/l10n/po/_
> par
>   http://www.nl.debian.org/intl/l10n/po/pot
> ;)

Attached. Ces scripts sont vraiment bordeliques... J'ai corrigé deux trois
minuscules petites choses en chemin.

Il faut regénérer data/langs (avec script/list-languages.pl) pour que ca
marche (ou remplacer _ par pot à la main dans data/langs).

Faudrait que je retrouve comment commiter moi meme, maintenant que je suis
mainteneur.

Mt.
Index: dtc.def
===================================================================
RCS file: /cvs/webwml/webwml/english/international/l10n/dtc.def,v
retrieving revision 1.43
diff -u -I^#: -r1.43 dtc.def
--- dtc.def	10 Sep 2003 07:39:55 -0000	1.43
+++ dtc.def	21 Jan 2005 12:41:29 -0000
@@ -39,6 +39,10 @@
   <gettext domain="l10n">Unknown language</gettext>
 </define-tag>
 
+<define-tag POT_Language whitespace=delete>
+  <gettext domain="l10n">PO template files</gettext>
+</define-tag>
+
 #
 # Footer
 #
@@ -161,8 +165,9 @@
 <:
 @polangs = ();
 open(LANGS, "< $(ENGLISHDIR)/international/l10n/data/langs")
-        || die "Unable to read $(ENGLISHDIR)/international/l10n/data/langs";
+        || die "Unable to read $(ENGLISHDIR)/international/l10n/data/langs (use script/list-languages.pl to regenerate it)";
 while (<LANGS>) {
+	s/_ /pot /;
         if (s/^po:\s+//) {
                 @polangs = split(' ', $_);
                 last;
@@ -170,7 +175,9 @@
 }
 close(LANGS);
 print "<ul>\n";
+print "<li>POT (<a href=\"pot\"><POT_Language /></a>)</li>\n";
 foreach my $l (sort @polangs) {
+	next if $lang eq 'pot';
         print "<li>$l (<a href=\"$l\">".language_name($l)."</a>)</li>\n";
 }
 print "</ul>\n";
Index: po/Makefile
===================================================================
RCS file: /cvs/webwml/webwml/english/international/l10n/po/Makefile,v
retrieving revision 1.12
diff -u -I^#: -r1.12 Makefile
--- po/Makefile	27 Aug 2004 06:26:35 -0000	1.12
+++ po/Makefile	21 Jan 2005 12:41:29 -0000
@@ -13,7 +13,7 @@
 L10N_DIR = $(ENGLISHDIR)/international/l10n
 DIST = unstable
 
-LANGS_PO  := $(shell grep 'po:' $(L10N_DIR)/data/langs | sed -e 's/po: *//')
+LANGS_PO  := $(shell grep 'po:' $(L10N_DIR)/data/langs | sed -e 's/po: *//' -e 's/_ /pot /')
 
 HTML_PO   := $(foreach lang,$(LANGS_PO),$(lang).$(LANGUAGE).html)
 
Index: scripts/gen-files.pl
===================================================================
RCS file: /cvs/webwml/webwml/english/international/l10n/scripts/gen-files.pl,v
retrieving revision 1.48
diff -u -I^#: -r1.48 gen-files.pl
--- scripts/gen-files.pl	31 Oct 2004 19:46:26 -0000	1.48
+++ scripts/gen-files.pl	21 Jan 2005 12:41:32 -0000
@@ -73,8 +73,13 @@
 my $tmpl_errors_maint = {};
 
 foreach my $pkg ($data->list_packages()) {
+    	next unless (length $pkg); # skip headers
         #   Populate arrays
         my $section = $data->section($pkg);
+    	unless (defined $section) {
+	    warn "Package without section: $pkg\n";
+	    next;
+	}
         if ($section =~ m#^(non-us/)?contrib/#) {
                 push (@contrib, $pkg);
         } elsif ($section =~ m#^(non-us/)?non-free/#) {
@@ -134,13 +139,10 @@
                         $translator = transform_translator($translator);
                         $team = transform_team($team);
                         if ($lang eq '_') {
-			        # FIXME: This wont work since the stats about the pot files are not in the DB
+			     	$lang = 'pot';
 			        if ($stat =~ m/(\d+)u/) {
                                         $total{$section} += $1;
                                 }
-			        # FIXME: Uncommenting the next line would prevent to use '_' as a 
-			        #        regular lang code, but I'm not sure of the implications
-#                                next;
                         }
                         $lang = uc($lang) || 'UNKNOWN';
                         $list{$lang} = 1;
@@ -156,16 +158,19 @@
                               "</tr>\n";
                         if ($stat =~ m/(\d+)t/) {
                                 $score{$lang} += $1;
-                        }
+                        } elsif ($lang eq 'pot') {
+			    	$stat =~ s/.*f//;
+			    	$stat =~ s/u//;
+			    	$score{'pot'} += $stat;
+			}
 		        if (percent_stat($stat) eq "100%") {
-                           $done{$lang}  = '' unless defined($done{$lang});
-			   $done{$lang} .= $str;
+			   $done{$lang} = ($done{$lang} || '') . $str; # avoid warning when concatening
  			} else {
-                           $todo{$lang}  = '' unless defined($todo{$lang});
-			   $todo{$lang} .= $str;
+			   $todo{$lang} = (($todo{$lang})|| '') . $str;
 			}
                 }
                 foreach $lang (@po_langs) {
+		    	$lang = 'pot' if $lang eq '_';
                         my $l = uc($lang) || 'UNKNOWN';
                         next if $list{$l};
                         $excl{$l}  = '' unless defined($excl{$l});
@@ -173,6 +178,7 @@
                 }
         }
         foreach $lang (@po_langs) {
+	    	$lang = 'pot' if $lang eq '_';
                 next unless defined $done{uc $lang};
                 open (GEN, "> $opt_l/po/gen/$section-$lang.ok")
                         || die "Unable to write into $opt_l/po/gen/$section-$lang.ok";
@@ -180,6 +186,7 @@
                 close (GEN);
         }
         foreach $lang (@po_langs) {
+	    	$lang = 'pot' if $lang eq '_';
                 next unless defined $todo{uc $lang};
                 open (GEN, "> $opt_l/po/gen/$section-$lang.todo")
                         || die "Unable to write into $opt_l/po/gen/$section-$lang.todo";
@@ -187,6 +194,7 @@
                 close (GEN);
         }
         foreach $lang (@po_langs) {
+	    	$lang = 'pot' if $lang eq '_';
                 next unless defined $excl{uc $lang};
                 $excl{uc $lang} =~ s/, $//s;
                 open (GEN, "> $opt_l/po/gen/$section-$lang.exc")
@@ -214,7 +222,10 @@
         open (GEN, "> $opt_l/po/gen/rank.inc")
                 || die "Unable to write into $opt_l/po/gen/rank.inc";
         print GEN "<dl>\n";
+        print GEN "<dt><a href=\"pot\">pot</a> ".($total{main}+$total{contrib}+$total{'non-free'})."</dt>\n";
+        print GEN "<dd><POT_Language /></dd>\n";
         foreach my $lang (sort {$score{uc $b} <=> $score{uc $a}} @po_langs) {
+	    	next if $lang eq 'pot';
                 print GEN "<dt><a href=\"$lang\">$lang</a> ".$score{uc $lang}."</dt>\n";
                 print GEN "<dd><language-name $lang /></dd>\n";
         }
Index: scripts/list-languages.pl
===================================================================
RCS file: /cvs/webwml/webwml/english/international/l10n/scripts/list-languages.pl,v
retrieving revision 1.4
diff -u -I^#: -r1.4 list-languages.pl
--- scripts/list-languages.pl	18 Jul 2004 21:18:25 -0000	1.4
+++ scripts/list-languages.pl	21 Jan 2005 12:41:32 -0000
@@ -40,6 +40,7 @@
         if ($data->has_po($pkg) && !defined($skip_po{$pkg})) {
                 foreach $line (@{$data->po($pkg)}) {
                         ($file, $lang) = @{$line};
+		    	$lang = 'pot' if ($lang eq '_');
                         $langs->{po}->{$lang}  = 1;
                         $langs->{all}->{$lang} = 1;
                 }

Attachment: signature.asc
Description: Digital signature


Reply to: