From 6dada565c8be2c59dfff9e9a9e806b78791b1ce8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Pr=C3=A9vot?= Date: Wed, 9 Mar 2011 23:18:59 +0000 Subject: Makes website translation stats available in other languages CVS version numbers stattrans.pl: 1.100 -> 1.101 english/devel/website/stats/Makefile: 1.1 -> 1.2 english/devel/website/stats/README: INITIAL -> 1.1 english/po/Makefile: 1.82 -> 1.83 english/po/stats.pot: INITIAL -> 1.1 english/template/debian/basic.wml: 1.93 -> 1.94 english/template/debian/navbar.wml: 1.83 -> 1.84 english/template/debian/stats_tags.wml: INITIAL -> 1.1 french/devel/website/stats/Makefile: INITIAL -> 1.1 french/po/stats.fr.po: INITIAL -> 1.1 --- stattrans.pl | 120 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 70 insertions(+), 50 deletions(-) (limited to 'stattrans.pl') diff --git a/stattrans.pl b/stattrans.pl index 80668389073..bdff370eff4 100755 --- a/stattrans.pl +++ b/stattrans.pl @@ -45,7 +45,7 @@ $| = 1; $opt_h = "/srv/www.debian.org/webwml/english/devel/website/stats"; $opt_w = "/srv/www.debian.org/webwml"; $opt_p = "*.(wml|src)"; -$opt_t = "Debian web site translation statistics"; +$opt_t = ''; $opt_v = 0; $opt_d = "u"; $opt_l = undef; @@ -200,16 +200,16 @@ sub check_translation # From translation-check.wml if ( $major_number != $major_translated_number ) { - return "This translation is too out of date"; + return 'This translation is too out of date'; } elsif ( $last_number - $last_translated_number < 0 ) { - return "Wrong translation version"; + return 'Wrong translation version'; } elsif ( $last_number - $last_translated_number >= $max_versions ) { - return "This translation is too out of date"; + return 'This translation is too out of date'; } elsif ( $last_number - $last_translated_number >= $min_versions ) { - return "The original is newer than this translation"; + return 'The original is newer than this translation'; } } elsif ( !$version && $translation) { - return "The original no longer exists"; + return 'The original no longer exists'; } return ""; } @@ -367,7 +367,7 @@ foreach $lang (@search_in) { foreach $file (@filenames) { next if ($file eq ""); (my $base = $file) =~ s/\.wml$//; - my $hits = exists $hits{$base} ? $hits{$base}.' hits' : 'hit count N/A'; + my $hits = exists $hits{$base} ? $hits{$base}.' hits' : 'hit count N/A'; # Translated pages if (index ($wmlfiles{$lang}, " $file ") >= 0) { $translated{$lang}++; @@ -386,7 +386,7 @@ foreach $lang (@search_in) { $o_body .= sprintf "%s", $transversion{"$lang/$file"}; $o_body .= sprintf "%s", $version{"$orig/$file"}; $o_body .= sprintf "%s", $msg; - if ($msg eq "Wrong translation version" || $msg eq "The original no longer exists") { + if ($msg eq 'Wrong translation version' || $msg eq 'The original no longer exists') { $o_body .= ""; } else { $o_body .= sprintf "%s\ ->\ %s", @@ -474,14 +474,14 @@ foreach $lang (@search_in) { $percent_us{$lang} = 100 - $percent_as{$lang}; if (open (HTML, ">$config{'htmldir'}/$l.wml")) { - printf HTML "#use wml::debian::template title=\"%s\"\n", ucfirst $lang; + printf HTML "#use wml::debian::template title=\"<:=\$trans{\$CUR_ISO_LANG}{%s}:>\"\n", $lang; print HTML "#use wml::debian::toc\n\n"; $color = get_color ($percent_a{$lang}); - printf HTML "\n", $color; + printf HTML '
Translation summary for <:=$trans{$CUR_ISO_LANG}{'.$lang.'} :>" style="background-color: %s; width: 100%; font-weight: bold; margin: 0; text-align: center;">'."\n", $color; print HTML "\n"; - print HTML "\n"; + print HTML ''."\n\n"; printf HTML "", $wml{$lang}, $percent_a{$lang}; printf HTML "", $translated{$lang}, $percent_t{$lang}; printf HTML "", $outdated{$lang}, $percent_o{$lang}; @@ -498,59 +498,65 @@ foreach $lang (@search_in) { # Make the table of content 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"; + 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\n"; + print HTML 'Outdated translations'."\n"; print HTML "
TranslatedUp-to-dateOutdatedNot translated
TranslatedUp to dateOutdatedNot translated
%d files (%.1f%%)%d files (%.1f%%)%d files (%.1f%%)
\n"; - print HTML ""; - if ($opt_d eq "u") { print HTML ""; } - elsif ($opt_d eq "h") { print HTML ""; } - else { print HTML ""; } - print HTML ""; - print HTML ""; - print HTML ""; + print HTML ''."\n"; + print HTML ''."\n"; + print HTML ''."\n"; + print HTML ''."\n"; + if ($opt_d eq "u") { print HTML ''; } + elsif ($opt_d eq "h") { print HTML ''; } + else { print HTML ''; } + print HTML ''; + print HTML ''; + print HTML ''; print HTML "\n"; print HTML $o_body; print HTML "
FileTranslatedOriginCommentUnified diffColored diffColored diffUnified diffDiffLogTranslationMaintainer
FileTranslationOriginCommentUnified diffColored diffColored diffUnified diffDiffLogTranslationMaintainer
\n"; } if ($u_body) { - print HTML "General pages not translated\n"; - print HTML "\n"; + print HTML 'General pages not translated'."\n"; + print HTML '
Untranslated general pages">'."\n"; print HTML $u_body; print HTML "
\n"; } if ($un_body) { - print HTML "News items not translated\n"; - print HTML "\n"; + print HTML 'News items not translated'."\n"; + print HTML '
Untranslated news items">'."\n"; print HTML $un_body; print HTML "
\n"; } if ($uu_body) { - print HTML "Consultant/user pages not translated\n"; - print HTML "\n"; + print HTML 'Consultant/user pages not translated'."\n"; + print HTML '
Untranslated consultant/user pages">'."\n"; print HTML $uu_body; print HTML "
\n"; } if ($ui_body) { - print HTML "International pages not translated\n"; - print HTML "\n"; + print HTML 'International pages not translated'."\n"; + print HTML '
Untranslated international pages">'."\n"; print HTML $ui_body; print HTML "
\n"; } if ($t_body) { - print HTML "Translated pages (up-to-date)\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)\n"; - print HTML "\n"; - print HTML "\n"; + print HTML 'Translated templates (PO files)'."\n"; + print HTML '
FileUp to dateFuzzyUntranslatedTotal
PO Translation Statistics" width="100%">'."\n"; + print HTML ''."\n"; + print HTML ''."\n"; + print HTML ''."\n"; + print HTML ''."\n"; foreach my $domain (sort keys %po_total) { next if $domain eq 'total'; print HTML ""; @@ -566,7 +572,8 @@ foreach $lang (@search_in) { printf HTML "", $po_total{$domain}; print HTML "\n"; } - print HTML ""; + print HTML "\n"; + print HTML ''; $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}); @@ -578,7 +585,7 @@ foreach $lang (@search_in) { print HTML "
FileUp to dateFuzzyUntranslated
%d
     
Total:
     
Total:
\n"; } - print HTML "
Created with webwml-stattrans
\n"; + print HTML '
Created with webwml-stattrans
'."\n"; close (HTML); } else { print "Can't open $config{'htmldir'}/$l.wml\n"; @@ -593,11 +600,12 @@ print "Creating index.wml... " if ($config{'verbose'}); open (HTMLI, ">$config{'htmldir'}/index.wml") || die "Can't open $config{'htmldir'}/index.wml"; +print HTMLI "#use wml::debian::stats_tags\n"; 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 '

Translated web pages

'."\n"; +printf HTMLI "

\n",($wml{'english'}+$untranslated{'english'}); -print HTMLI "\n"; +print HTMLI '
Translation Statistics by Page Count" class="stattrans">'."\n"; print HTMLI "\n"; print HTMLI "\n"; print HTMLI ""; @@ -612,7 +620,11 @@ print HTMLI "\n"; print HTMLI "\n"; print HTMLI ""; print HTMLI ""; -print HTMLI "\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; print HTMLI ""; print HTMLI ""; foreach $lang (@search_in) { @@ -625,7 +637,7 @@ foreach $lang (@search_in) { $color_u = get_color (100 - $percent_u{$lang}); print HTMLI ""; - printf HTMLI "", $l, ucfirst $lang, $l; + printf HTMLI "", $l, $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}; @@ -636,10 +648,10 @@ foreach $lang (@search_in) { print HTMLI ""; print HTMLI "
LanguageTranslationsUp to dateOutdatedNot translated
LanguageTranslationsUp to dateOutdatedNot translated
%s (%s)<:=\$trans{\$CUR_ISO_LANG}{%s} :> (%s)%d(%.1f%%)%d(%.1f%%)%d(%.1f%%)
\n"; -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 '

Translated web pages (by size)

'."\n"; +printf HTMLI "

\n",($wml_s{'english'}+$untranslated_s{'english'}); -print HTMLI "\n"; +print HTMLI '
Translation Statistics by Page Size" class="stattrans">'."\n"; print HTMLI "\n"; print HTMLI "\n"; print HTMLI ""; @@ -654,7 +666,11 @@ print HTMLI "\n"; print HTMLI "\n"; print HTMLI ""; print HTMLI ""; -print HTMLI "\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; print HTMLI ""; print HTMLI ""; @@ -668,7 +684,7 @@ foreach $lang (@search_in) { $color_u = get_color (100 - $percent_u{$lang}); print HTMLI ""; - printf HTMLI "", $l, ucfirst $lang, $l; + printf HTMLI "", $l, $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}; @@ -679,9 +695,10 @@ foreach $lang (@search_in) { print HTMLI ""; print HTMLI "
LanguageTranslationsUp to dateOutdatedNot translated
LanguageTranslationsUp to dateOutdatedNot translated
%s (%s)<:=\$trans{\$CUR_ISO_LANG}{%s} :> (%s)%d(%.1f%%)%d(%.1f%%)%d(%.1f%%)
\n"; -print HTMLI "

Translated templates (gettext files)

\n"; -printf HTMLI "

There are %d strings to translate.

\n",$po_total{'total'}; -print HTMLI "\n"; +print HTMLI '

Translated templates (PO files)

'."\n"; +printf HTMLI "

\n",$po_total{'total'}; + +print HTMLI '
PO Translation Statistics"class="stattrans">'."\n"; print HTMLI "\n"; print HTMLI ""; print HTMLI "\n"; @@ -693,7 +710,10 @@ print HTMLI "\n"; print HTMLI "\n"; print HTMLI ""; print HTMLI ""; -print HTMLI "\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; +print HTMLI ''."\n"; print HTMLI ""; print HTMLI ""; foreach $lang (@search_in) { @@ -702,7 +722,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, $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}); @@ -716,7 +736,7 @@ foreach $lang (@search_in) { print HTMLI ""; print HTMLI "
LanguageUp to dateFuzzyNot translated
LanguageUp to dateFuzzyNot translated
%s (%s)<:=\$trans{\$CUR_ISO_LANG}{%s} :> (%s)
\n"; -print HTMLI "
Created with webwml-stattrans
\n"; +print HTMLI '
Created with webwml-stattrans
'."\n"; close (HTMLI); print "done.\n" if ($config{'verbose'}); -- cgit v1.2.3