[Commits] [SCM] claws branch, master, updated. 3.17.5-15-g68d88ecf5
mones at claws-mail.org
mones at claws-mail.org
Sat May 9 21:41:08 CEST 2020
The branch, master has been updated
via 68d88ecf5cc6184de3f528b0d7ab121c40837aa9 (commit)
from 8d1aa9e340b4da28d0d57f21ba0d15e0811af67f (commit)
Summary of changes:
tools/claws.i18n.status.pl | 355 ++++++++++++++++++++++++++-------------------
1 file changed, 203 insertions(+), 152 deletions(-)
- Log -----------------------------------------------------------------
commit 68d88ecf5cc6184de3f528b0d7ab121c40837aa9
Author: Ricardo Mones <ricardo at mones.org>
Date: Sat May 9 21:40:53 2020 +0200
Try to use more modern Perl
diff --git a/tools/claws.i18n.status.pl b/tools/claws.i18n.status.pl
index f23ac6b42..cb991bfa2 100644
--- a/tools/claws.i18n.status.pl
+++ b/tools/claws.i18n.status.pl
@@ -1,118 +1,176 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
#
# claws.i18n.stats.pl - Generate statistics for Claws Mail po directory.
-#
+#
# Copyright (C) 2003-2020 by Ricardo Mones <ricardo at mones.org>,
# Paul Mangan <paul at claws-mail.org>
# This program is released under the GNU General Public License.
#
-# constants -----------------------------------------------------------------
+use warnings;
+use strict;
+use File::Which;
-%langname = (
-# 'bg.po' => 'Bulgarian',
- 'ca.po' => 'Catalan',
- 'cs.po' => 'Czech',
- 'da.po' => 'Danish',
- 'de.po' => 'German',
- 'el_GR.po' => 'Greek',
- 'en_GB.po' => 'British English',
-# 'eo.po' => 'Esperanto',
- 'es.po' => 'Spanish',
- 'fi.po' => 'Finnish',
- 'fr.po' => 'French',
-# 'he.po' => 'Hebrew',
- 'hu.po' => 'Hungarian',
- 'id_ID.po' => 'Indonesian',
- 'it.po' => 'Italian',
- 'ja.po' => 'Japanese',
-# 'lt.po' => 'Lithuanian',
- 'nb.po' => 'Norwegian Bokmål',
- 'nl.po' => 'Dutch',
- 'pl.po' => 'Polish',
- 'pt_BR.po' => 'Brazilian Portuguese',
- 'pt_PT.po' => 'Portuguese',
- 'ro.po' => 'Romanian',
- 'ru.po' => 'Russian',
- 'sk.po' => 'Slovak',
- 'sv.po' => 'Swedish',
- 'tr.po' => 'Turkish',
-# 'uk.po' => 'Ukrainian',
-# 'zh_CN.po' => 'Simplified Chinese',
- 'zh_TW.po' => 'Traditional Chinese',
-);
-
-%lasttranslator = (
-# 'bg.po' => 'Yasen Pramatarov <yasen at lindeas.com>',
- 'ca.po' => 'David Medina <opensusecatala at gmail.com>',
- 'cs.po' => 'David Vachulka <david at konstrukce-cad.com>',
- 'da.po' => 'Erik P. Olsen <epodata at gmail.com>',
- 'de.po' => 'Simon Legner <simon.legner at gmail.com>',
- 'el_GR.po' => 'Haris Karachristianidis <hariskar at cryptolab.net>',
- 'en_GB.po' => 'Paul Mangan <paul at claws-mail.org>',
-# 'eo.po' => 'Sian Mountbatten <poenikatu at fastmail.co.uk>',
- 'es.po' => 'Ricardo Mones Lastra <ricardo at mones.org>',
- 'fi.po' => 'Flammie Pirinen <flammie at iki.fi>',
- 'fr.po' => 'Tristan Chabredier <wwp at claws-mail.org>',
-# 'he.po' => 'Isratine Citizen <genghiskhan at gmx.ca>',
- 'hu.po' => 'Páder Rezső <rezso at rezso.net>',
- 'id_ID.po' => 'MSulchan Darmawan <bleketux at gmail.com>',
- 'it.po' => 'Luigi Votta <luigi.vtt at gmail.com>',
- 'ja.po' => 'UTUMI Hirosi <utuhiro78 at yahoo.co.jp>',
-# 'lt.po' => 'Mindaugas Baranauskas <embar at super.lt>',
- 'nb.po' => 'Petter Adsen <petter at synth.no>',
- 'nl.po' => 'Marcel Pol <mpol at gmx.net>',
- 'pl.po' => 'Jakub Jankiewicz <jcubic at jcubic.pl>',
- 'pt_BR.po' => 'Frederico Goncalves Guimaraes <fggdebian at yahoo.com.br>',
- 'pt_PT.po' => 'Pedro Albuquerque <palbuquerque73 at gmail.com>',
- 'ro.po' => 'Cristian Secară <liste at secarica.ro>',
- 'ru.po' => 'Mikhail Kurinnoi <viewizard at viewizard.com>',
- 'sk.po' => 'Slavko <slavino at slavino.sk>',
- 'sv.po' => 'Andreas Rönnquist <gusnan at openmailbox.org>',
- 'tr.po' => 'Numan Demirdöğen <if.gnu.linux at gmail.com>',
-# 'uk.po' => 'YUP <yupadmin at gmail.com>',
-# 'zh_CN.po' => 'Rob <rbnwmk at gmail.com>',
- 'zh_TW.po' => 'Mark Chang <mark.cyj at gmail.com>',
+# constants -----------------------------------------------------------------
+my %lang = (
+ 'bg.po' => {
+ 'out' => 0, 'name' => 'Bulgarian',
+ 'last' => 'Yasen Pramatarov <yasen at lindeas.com>',
+ },
+ 'ca.po' => {
+ 'out' => 1, 'name' => 'Catalan',
+ 'last' => 'David Medina <opensusecatala at gmail.com>',
+ },
+ 'cs.po' => {
+ 'out' => 1, 'name' => 'Czech',
+ 'last' => 'David Vachulka <david at konstrukce-cad.com>',
+ },
+ 'da.po' => {
+ 'out' => 1, 'name' => 'Danish',
+ 'last' => 'Erik P. Olsen <epodata at gmail.com>',
+ },
+ 'de.po' => {
+ 'out' => 1, 'name' => 'German',
+ 'last' => 'Simon Legner <simon.legner at gmail.com>',
+ },
+ 'el_GR.po' => {
+ 'out' => 1, 'name' => 'Greek',
+ 'last' => 'Haris Karachristianidis <hariskar at cryptolab.net>',
+ },
+ 'en_GB.po' => {
+ 'out' => 1, 'name' => 'British English', 'lazy' => 1,
+ 'last' => 'Paul Mangan <paul at claws-mail.org>',
+ },
+ 'eo.po' => {
+ 'out' => 0, 'name' => 'Esperanto',
+ 'last' => 'Sian Mountbatten <poenikatu at fastmail.co.uk>',
+ },
+ 'es.po' => {
+ 'out' => 1, 'name' => 'Spanish',
+ 'last' => 'Ricardo Mones <ricardo at mones.org>',
+ },
+ 'fi.po' => {
+ 'out' => 1, 'name' => 'Finnish',
+ 'last' => 'Flammie Pirinen <flammie at iki.fi>',
+ },
+ 'fr.po' => {
+ 'out' => 1, 'name' => 'French',
+ 'last' => 'Tristan Chabredier <wwp at claws-mail.org>',
+ },
+ 'he.po' => {
+ 'out' => 0, 'name' => 'Hebrew',
+ 'last' => 'Isratine Citizen <genghiskhan at gmx.ca>',
+ },
+ 'hu.po' => {
+ 'out' => 1, 'name' => 'Hungarian',
+ 'last' => 'Páder Rezső <rezso at rezso.net>',
+ },
+ 'id_ID.po' => {
+ 'out' => 1, 'name' => 'Indonesian',
+ 'last' => 'MSulchan Darmawan <bleketux at gmail.com>',
+ },
+ 'it.po' => {
+ 'out' => 1, 'name' => 'Italian',
+ 'last' => 'Luigi Votta <luigi.vtt at gmail.com>',
+ },
+ 'ja.po' => {
+ 'out' => 1, 'name' => 'Japanese',
+ 'last' => 'UTUMI Hirosi <utuhiro78 at yahoo.co.jp>',
+ },
+ 'lt.po' => {
+ 'out' => 0, 'name' => 'Lithuanian',
+ 'last' => 'Mindaugas Baranauskas <embar at super.lt>',
+ },
+ 'nb.po' => {
+ 'out' => 1, 'name' => 'Norwegian Bokmål',
+ 'last' => 'Petter Adsen <petter at synth.no>',
+ },
+ 'nl.po' => {
+ 'out' => 1, 'name' => 'Dutch',
+ 'last' => 'Marcel Pol <mpol at gmx.net>',
+ },
+ 'pl.po' => {
+ 'out' => 1, 'name' => 'Polish',
+ 'last' => 'Jakub Jankiewicz <jcubic at jcubic.pl>',
+ },
+ 'pt_BR.po' => {
+ 'out' => 1, 'name' => 'Brazilian Portuguese',
+ 'last' => 'Frederico Goncalves Guimaraes <fggdebian at yahoo.com.br>',
+ },
+ 'pt_PT.po' => {
+ 'out' => 1, 'name' => 'Portuguese',
+ 'last' => 'Pedro Albuquerque <palbuquerque73 at gmail.com>',
+ },
+ 'ro.po' => {
+ 'out' => 1, 'name' => 'Romanian',
+ 'last' => 'Cristian Secară <liste at secarica.ro>',
+ },
+ 'ru.po' => {
+ 'out' => 1, 'name' => 'Russian',
+ 'last' => 'Mikhail Kurinnoi <viewizard at viewizard.com>',
+ },
+ 'sk.po' => {
+ 'out' => 1, 'name' => 'Slovak',
+ 'last' => 'Slavko <slavino at slavino.sk>',
+ },
+ 'sv.po' => {
+ 'out' => 1, 'name' => 'Swedish',
+ 'last' => 'Andreas Rönnquist <gusnan at openmailbox.org>',
+ },
+ 'tr.po' => {
+ 'out' => 1, 'name' => 'Turkish',
+ 'last' => 'Numan Demirdöğen <if.gnu.linux at gmail.com>',
+ },
+ 'uk.po' => {
+ 'out' => 0, 'name' => 'Ukrainian',
+ 'last' => 'YUP <yupadmin at gmail.com>',
+ },
+ 'zh_CN.po' => {
+ 'out' => 0, 'name' => 'Simplified Chinese',
+ 'last' => 'Rob <rbnwmk at gmail.com>',
+ },
+ 'zh_TW.po' => {
+ 'out' => 1, 'name' => 'Traditional Chinese',
+ 'last' => 'Mark Chang <mark.cyj at gmail.com>',
+ },
);
-%barcolornorm = (
+my %barcolornorm = (
default => 'white',
partially => 'lightblue',
completed => 'blue',
);
-%barcoloraged = (
+my %barcoloraged = (
default => 'white',
partially => 'lightgrey', # ligth red '#FFA0A0',
completed => 'grey', # darker red '#FF7070',
);
-%barcolorcheat = ( # remarks translations with revision dates in the future
+my %barcolorcheat = ( # remarks translations with revision dates in the future
default => 'white',
partially => 'yellow',
completed => 'red',
);
-$barwidth = 500; # pixels
-$barheight = 12; # pixels
+my ($barwidth, $barheight) = (500, 12); # pixels
-$transolddays = 120; # days to consider a translation is old, so probably unmaintained.
-$transoldmonths = $transolddays / 30;
-$transneedthresold = 0.75; # percent/100
+my $transolddays = 120; # days to consider a translation is old, so probably unmaintained.
+my $transoldmonths = $transolddays / 30;
+my $transneedthresold = 0.75; # percent/100
-$msgfmt = '/usr/bin/msgfmt';
+my ($msgfmt, $date, $grep, $cut) = map {
+ my $bin = which($_); die "missing '$_' binary" unless defined $bin; $bin
+} qw(msgfmt date grep cut);
-$averagestr = 'Project average';
-$contactaddress = 'translations at thewildbeast.co.uk';
-
-# $pagehead = '../../claws.i18n.head.php';
-# $pagetail = '../../claws.i18n.tail.php';
+my $averageitem = {'name' => 'Project average', 'out' => 1, 'last' => ''};
+my $contactaddress = 'translations at thewildbeast.co.uk';
# code begins here ----------------------------------------------------------
sub get_current_date {
- $date = `date --utc`;
- chop $date;
- $date =~ /(\S+)(\s+)(\S+)(\s+)(\S+)(\s+)(\S+)(\D+)(\d+)/;
- $datetimenow = "$5-$3-$9 at $7"."$8";
+ my $utc = qx{$date --utc};
+ chop $utc;
+ $utc =~ /(\S+)(\s+)(\S+)(\s+)(\S+)(\s+)(\S+)(\D+)(\d+)/;
+ return "$5-$3-$9 at $7"."$8";
}
sub get_trans_age {
@@ -120,42 +178,52 @@ sub get_trans_age {
return ($y * 365) + ($m * 31) + $d;
}
-($sec,$min,$hour,$mday,$mon,$year,$wday,$yday) = gmtime(time);
+my (undef, undef, undef, $mday, $mon, $year, undef, undef) = gmtime(time);
$year += 1900;
$mon++;
-$cage = get_trans_age($year,$mon,$mday); # get current "age"
+my $cage = get_trans_age($year, $mon, $mday); # get current "age"
# drawing a language status row
sub print_lang {
- my ($lang, $person, $trans, $fuzzy, $untrans, $tage, $oddeven) = @_;
- $total = $trans + $fuzzy + $untrans;
+ my ($langmap, $trans, $fuzzy, $untrans, $tage, $oddeven) = @_;
+ return if not $langmap->{'out'};
+ my $lang = $langmap->{'name'};
+ my $person = $langmap->{'last'};
+ my $total = $trans + $fuzzy + $untrans;
if ($tage == 0) { $tage = $cage; } # hack for average translation
- print STDERR $cage, " ", $tage, "\n";
+ # print STDERR $cage, " ", $tage, "\n";
+ my ($barcolor, $pname, $pemail);
if (($cage - $tage) < 0) {
$barcolor = \%barcolorcheat;
} else {
$barcolor = (($cage - $tage) > $transolddays)? \%barcoloraged : \%barcolornorm ;
}
$_ = $person;
- if (/(.+)\s+\<(.+)\>/) { $pname = $1; $pemail = $2; } else { $pname = $pemail = $contactaddress; }
- print "<tr";
- if ($oddeven > 0) { print " bgcolor=#EFEFEF"; }
- print ">\n<td>\n";
- if ($lang eq $averagestr) {
+ if (/(.+)\s+\<(.+)\>/) {
+ $pname = $1; $pemail = $2;
+ } else {
+ $pname = $pemail = $contactaddress;
+ }
+ print '<tr', ($oddeven? ' bgcolor=#EFEFEF': ''), ">\n<td>\n";
+ if ($lang eq $averageitem->{'name'}) {
print "<b>$lang</b>";
} else {
print "<a href=\"mailto:%22$pname%22%20<$pemail>\">$lang</a>";
}
print "</td>\n";
- print "<td>\n<table style='border: solid 1px black; width: $barwidth' border='0' cellspacing='0' cellpadding='0'><tr>\n";
- $barlen = ($trans / $total) * $barwidth;
- print "<td style='width:$barlen", "px; height:$barheight", "px;' bgcolor=\"$$barcolor{completed}\"></td>\n";
- $barlen2 = ($fuzzy / $total) * $barwidth;
+ print "<td>\n<table style='border: solid 1px black; width: $barwidth'",
+ " border='0' cellspacing='0' cellpadding='0'><tr>\n";
+ my $barlen = ($trans / $total) * $barwidth;
+ print "<td style='width:$barlen", "px; height:$barheight",
+ "px;' bgcolor=\"$$barcolor{completed}\"></td>\n";
+ my $barlen2 = ($fuzzy / $total) * $barwidth;
print "<td style='width:$barlen2", "px' bgcolor=\"$$barcolor{partially}\"></td>\n";
- $barlen3 = $barwidth - $barlen2 - $barlen;
+ my $barlen3 = $barwidth - $barlen2 - $barlen;
print "<td style='width:$barlen3", "px' bgcolor=\"$$barcolor{default}\"></td>\n";
- print "</tr>\n</table>\n</td>\n\n<td style='text-align: right'>", int(($trans / $total) * 10000) / 100, "%</td>\n";
- $transtatus = (($trans / $total) < $transneedthresold)? '<font size="+1" color="red"> * </font>': '';
+ print "</tr>\n</table>\n</td>\n\n<td style='text-align: right'>",
+ int(($trans / $total) * 10000) / 100, "%</td>\n";
+ my $transtatus = (($trans / $total) < $transneedthresold)
+ ? '<font size="+1" color="red"> * </font>': '';
print "<td>$transtatus</td>\n</tr>\n";
}
@@ -164,24 +232,28 @@ sub tens {
return (($i > 9)? "$i" : "0$i");
}
-get_current_date();
+my $datetimenow = get_current_date();
# get project version from changelog (project dependent code :-/ )
-$_ = `head -1 ../ChangeLog`;
-if (/\S+\s+\S+\s+(\S+)/) { $genversion = $1; } else { $genversion = 'Unknown'; }
-
-$numlang = keys(%langname);
-
-# print `cat $pagehead`;
-#
-# make it a here-doc
-#print <<ENDOFHEAD;
-# removed for being included
-#ENDOFHEAD
+my $genversion = 'Unknown';
+my $changelog = '../Changelog';
+if (-s $changelog) {
+ my $head = which('head');
+ if (defined $head) {
+ $_ = qx{$head -1 $changelog};
+ if (/\S+\s+\S+\s+(\S+)/) { $genversion = $1; }
+ }
+} else {
+ my $git = which('git');
+ if (defined $git) {
+ $_ = qx{$git describe --abbrev=0};
+ if (/(\d+\.\d+\.\d)/) { $genversion = $1; }
+ }
+}
# start
print qq ~<div class=indent>
- <b>Translation Status (on $datetimenow for $genversion)</b>
+ <b>Translation Status (on $datetimenow for $genversion)</b>
<div class=indent>
<table cellspacing=0 cellpadding=2>~;
@@ -194,20 +266,21 @@ print qq ~<tr bgcolor=#cccccc>
</tr>~;
# get files
+my @pofiles;
opendir(PODIR, ".") || die("Error: can't open current directory\n");
push(@pofiles,(readdir(PODIR)));
closedir(PODIR);
- at sorted_pofiles = sort(@pofiles);
+my @sorted_pofiles = sort(@pofiles);
# iterate them
-$alang = $atran = $afuzz = $auntr = $oddeven = 0;
-foreach $pofile (@sorted_pofiles) {
+my ($alang, $atran, $afuzz, $auntr, $oddeven) = (0, 0, 0, 0, 0);
+foreach my $pofile (@sorted_pofiles) {
$_ = $pofile;
- if (/.+\.po$/ && defined($langname{$pofile}) ) {
+ if (/.+\.po$/ && defined($lang{$pofile}) ) {
print STDERR "Processing $_\n"; # be a little informative
++$alang;
- $transage = $tran = $fuzz = $untr = 0;
- $_ = `$msgfmt -c --statistics -o /dev/null $pofile 2>&1`;
+ my ($transage, $tran, $fuzz, $untr) = (0, 0, 0, 0);
+ $_ = qx{$msgfmt -c --statistics -o /dev/null $pofile 2>&1};
if (/([0-9]+)\s+translated/) {
$tran = $1;
}
@@ -221,51 +294,29 @@ foreach $pofile (@sorted_pofiles) {
$atran += $tran;
$afuzz += $fuzz;
$auntr += $untr;
- if ($pofile eq "en_GB.po") {
- $tran = $tran+$fuzz;
+ if ($lang{$pofile}->{'lazy'}) {
+ $tran = $tran + $fuzz;
$untr = "0";
$fuzz = "0";
$transage = $cage;
} else {
- $_ = `grep 'PO-Revision-Date:' $pofile | cut -f2 -d:`;
- if (/\s+(\d+)\-(\d+)\-(\d+)/) {
- $transage = get_trans_age($1,$2,$3);
+ $_ = qx{$grep 'PO-Revision-Date:' $pofile | $cut -f2 -d:};
+ if (/\s+(\d+)\-(\d+)\-(\d+)/) {
+ $transage = get_trans_age($1, $2, $3);
}
}
- print_lang($langname{$pofile},$lasttranslator{$pofile},$tran,$fuzz,$untr,$transage, $oddeven);
- if ($oddeven == 1) { $oddeven = 0 } else { $oddeven++; }
+ print_lang($lang{$pofile}, $tran, $fuzz, $untr, $transage, $oddeven);
+ $oddeven = $oddeven? 0: 1;
}
}
# average results for the project
print "<tr>\n<td colspan=3 height=8></td>\n<tr>";
-print_lang($averagestr,'',$atran,$afuzz,$auntr,0,0);
-
+print_lang($averageitem, $atran, $afuzz, $auntr, 0, 0);
+
# table footer
print "</table>\n";
-
-# end
-# print "<br>Number of languages supported: $alang <br>";
-# print qq ~<p>
-# Languages marked with <font size="+1" color="red"> *</font>
-# really need your help to be completed.
-# <p>
-# The ones with grey bars are <i>probably unmaintained</i> because
-# translation is more than $transoldmonths months old, anyway, trying
-# to contact current translator first is usually a good idea before
-# submitting an updated one.<p><b>NOTE</b>: if you are the translator
-# of one of them and don't want to see your language bar in grey you
-# should manually update the <tt>PO-Revision-Date</tt> field in the .po
-# file header (or, alternatively, use a tool which does it for you).
-# <br>
print qq ~</div>
</div>~;
-# print `cat $pagetail`;
-#
-# make it a here-doc
-#print <<ENDOFTAIL;
-# removed for being included
-#ENDOFTAIL
-
# done
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list