From a879ba71c195fa31732dfac10aa5d9973c9bdb08 Mon Sep 17 00:00:00 2001 From: Tobias Quathamer Date: Mon, 7 Mar 2011 20:07:35 +0000 Subject: Write WML files instead of HTML to enable the use of the new layout CVS version numbers stattrans.pl: 1.96 -> 1.97 --- stattrans.pl | 109 ++++++++++++++--------------------------------------------- 1 file changed, 25 insertions(+), 84 deletions(-) (limited to 'stattrans.pl') diff --git a/stattrans.pl b/stattrans.pl index e83230ba43d..2cf072eb407 100755 --- a/stattrans.pl +++ b/stattrans.pl @@ -42,7 +42,7 @@ BEGIN { $| = 1; -$opt_h = "/org/www.debian.org/www/devel/website/stats"; +$opt_h = "/org/www.debian.org/webwml/devel/website/stats"; $opt_w = "/org/www.debian.org/webwml"; $opt_p = "*.(wml|src)"; $opt_t = "Debian web site translation statistics"; @@ -349,7 +349,7 @@ foreach $lang (@search_in) { my @processed_langs = ($langs{$lang}); @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; foreach $l (@processed_langs) { - print "$l.html " if ($config{'verbose'}); + print "$l.wml " if ($config{'verbose'}); $charset{$lang}; open (wmlrc,"$opt_w/$lang/.wmlrc") ; @@ -473,21 +473,13 @@ foreach $lang (@search_in) { $percent_u{$lang} = 100 - $percent_a{$lang}; $percent_us{$lang} = 100 - $percent_as{$lang}; - if (open (HTML, ">$config{'htmldir'}/$l.html")) { - printf HTML "\n"; - # printf HTML "%s: %s\n", $config{'title'}, ucfirst $lang; - printf HTML "\n\n"; - printf HTML " \n"; - printf HTML " %s: %s\n", $config{'title'}, ucfirst $lang; - print HTML " "; - print HTML "\n\n"; + if (open (HTML, ">$config{'htmldir'}/$l.wml")) { + printf HTML "#use wml::debian::template title=\"%s\"\n", ucfirst $lang; + print HTML "#use wml::debian::toc\n\n"; $color = get_color ($percent_a{$lang}); - printf HTML "

", $color; - printf HTML "%s: %s

\n", $config{'title'}, ucfirst $lang; - printf HTML "\n", $color; + printf HTML "
\n", $color; print HTML "\n"; - # printf HTML "", $config{'title'}, ucfirst $lang; print HTML "\n"; printf HTML "", $wml{$lang}, $percent_a{$lang}; @@ -504,45 +496,14 @@ foreach $lang (@search_in) { print HTML "

%s: %s

TranslatedUp-to-dateOutdatedNot translated
%d files (%.1f%%)
\n"; # Make the table of content - print HTML "

Table of Contents

\n"; - print HTML "\n"; - + print HTML "\n"; if (%hits) { print HTML "

Note: The lists of pages are sorted by popularity. Hover over the page name to see the number of hits.

\n"; } # outputs the content if ($o_body) { - print HTML "

Outdated translations: (top)

\n"; + print HTML "Outdated translations\n"; print HTML "\n"; print HTML ""; if ($opt_d eq "u") { print HTML ""; } @@ -556,39 +517,38 @@ foreach $lang (@search_in) { print HTML "
FileTranslatedOriginCommentUnified diffColored diff
\n"; } if ($u_body) { - print HTML "

General pages not translated: (top)

\n"; + print HTML "General pages not translated\n"; print HTML "\n"; print HTML $u_body; print HTML "
\n"; } if ($un_body) { - print HTML "

News items not translated: (top)

\n"; + print HTML "News items not translated\n"; print HTML "\n"; print HTML $un_body; print HTML "
\n"; } if ($uu_body) { - print HTML "

Consultant/user pages not translated: (top)

\n"; + print HTML "Consultant/user pages not translated\n"; print HTML "\n"; print HTML $uu_body; print HTML "
\n"; } if ($ui_body) { - print HTML "

International pages not translated: (top)

\n"; + print HTML "International pages not translated\n"; print HTML "\n"; print HTML $ui_body; print HTML "
\n"; } if ($t_body) { - print HTML "

Translated pages (up-to-date): (top)

\n"; + print HTML "Translated pages (up-to-date)\n"; print HTML "\n"; } # outputs the gettext stats if ($lang ne 'english') { - print HTML "

Translation of templates (gettext files): (top)

\n"; -# print HTML $border_head; + print HTML "Translation of templates (gettext files)\n"; print HTML "\n"; print HTML "\n"; foreach my $domain (sort keys %po_total) { @@ -618,9 +578,7 @@ foreach $lang (@search_in) { print HTML "
FileUp to dateFuzzyUntranslatedTotal
\n"; } - # outputs footer - print HTML "
Compiled at $date
\n"; - print HTML ""; + print HTML "

Created with webwml-stattrans

\n"; close (HTML); } } @@ -628,23 +586,15 @@ foreach $lang (@search_in) { print "\n" if ($config{'verbose'}); # =============== Creating index.html =============== -print "Creating index.html... " if ($config{'verbose'}); - -open (HTMLI, ">$config{'htmldir'}/index.html") - || die "Can't open $config{'htmldir'}/index.html"; - -# printf HTMLI "\n%s\n\n", $config{'title'}; -# printf HTMLI "

%s

\n", $config{'title'}; -printf HTMLI "\n\n\n"; -printf HTMLI " \n"; -printf HTMLI " %s\n", $config{'title'}; -print HTMLI " "; -printf HTMLI "\n\n"; -printf HTMLI "

%s

\n", $config{'title'}; +print "Creating index.wml... " if ($config{'verbose'}); + +open (HTMLI, ">$config{'htmldir'}/index.wml") + || die "Can't open $config{'htmldir'}/index.wml"; + +printf HTMLI "#use wml::debian::template title=\"%s\"\n\n", $config{'title'}; print HTMLI "

Translated web pages

\n"; printf HTMLI "

There are %d pages to translate.

\n",($wml{'english'}+$untranslated{'english'}); -# print HTMLI $border_head; print HTMLI "\n"; print HTMLI "\n"; print HTMLI "\n"; @@ -673,7 +623,7 @@ foreach $lang (@search_in) { $color_u = get_color (100 - $percent_u{$lang}); print HTMLI ""; - printf HTMLI "", $l, ucfirst $lang, $l; + printf HTMLI "", $l, ucfirst $lang, $l; printf HTMLI "", $color_a, $wml{$lang}, $percent_a{$lang}; printf HTMLI "", $color_t, $translated{$lang}, $percent_t{$lang}; printf HTMLI "", $color_o, $outdated{$lang}, $percent_o{$lang}; @@ -683,14 +633,11 @@ foreach $lang (@search_in) { } print HTMLI ""; print HTMLI "
%s (%s)%s (%s)%d(%.1f%%)%d(%.1f%%)%d(%.1f%%)
\n"; -# print HTMLI $border_foot; print HTMLI "

Translated web pages (by size)

\n"; printf HTMLI "

There are %d bytes to translate.

\n",($wml_s{'english'}+$untranslated_s{'english'}); -# print HTMLI $border_head; print HTMLI "\n"; -# print HTMLI "
\n"; print HTMLI "\n"; print HTMLI "\n"; print HTMLI ""; @@ -719,7 +666,7 @@ foreach $lang (@search_in) { $color_u = get_color (100 - $percent_u{$lang}); print HTMLI ""; - printf HTMLI "", $l, ucfirst $lang, $l; + printf HTMLI "", $l, ucfirst $lang, $l; printf HTMLI "", $color_a, $wml_s{$lang}, $percent_as{$lang}; printf HTMLI "", $color_t, $translated_s{$lang}, $percent_ts{$lang}; printf HTMLI "", $color_o, $outdated_s{$lang}, $percent_os{$lang}; @@ -729,13 +676,10 @@ foreach $lang (@search_in) { } print HTMLI ""; print HTMLI "
%s (%s)%s (%s)%d(%.1f%%)%d(%.1f%%)%d(%.1f%%)
\n"; -# print HTMLI $border_foot; print HTMLI "

Translated templates (gettext files)

\n"; printf HTMLI "

There are %d strings to translate.

\n",$po_total{'total'}; -# print HTMLI $border_head; print HTMLI "\n"; -# print HTMLI "
\n"; print HTMLI "\n"; print HTMLI ""; print HTMLI "\n"; @@ -756,7 +700,7 @@ foreach $lang (@search_in) { @processed_langs = ("zh-cn", "zh-tw") if $langs{$lang} eq "zh"; foreach $l (@processed_langs) { print HTMLI ""; - printf HTMLI "", $l, ucfirst $lang, $l; + printf HTMLI "", $l, ucfirst $lang, $l; $color_t = get_color ($percent_po_t{'total'}{$lang}); $color_f = get_color (100 - $percent_po_f{'total'}{$lang}); $color_u = get_color (100 - $percent_po_u{'total'}{$lang}); @@ -769,11 +713,8 @@ foreach $lang (@search_in) { print HTMLI ""; print HTMLI "
%s (%s)%s (%s)
\n"; -# print HTMLI $border_foot; -print HTMLI "


\n"; -print HTMLI "

Created with webwml-stattrans on $date
\n"; -print HTMLI "\n"; +print HTMLI "

Created with webwml-stattrans

\n"; close (HTMLI); print "done.\n" if ($config{'verbose'}); -- cgit v1.2.3