aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Owsiany <porridge>2012-06-18 11:30:04 +0000
committerMarcin Owsiany <porridge>2012-06-18 11:30:04 +0000
commite529c4236ac90788d42d0239501c224d7156d7c9 (patch)
tree5026b76f80052cfa455b03cf0ebdf9548877c29b
parenta6295f5aaf7330c6f0e448b0bbfee55921c71cfa (diff)
Mention the host and time for hit data on stats pages.
CVS version numbers stattrans.pl: 1.109 -> 1.110 english/po/stats.pot: 1.5 -> 1.6 english/template/debian/stats_tags.wml: 1.2 -> 1.3
-rw-r--r--english/po/stats.pot169
-rw-r--r--english/template/debian/stats_tags.wml4
-rwxr-xr-xstattrans.pl20
3 files changed, 107 insertions, 86 deletions
diff --git a/english/po/stats.pot b/english/po/stats.pot
index f12cebe2d7b..62bda46c3ce 100644
--- a/english/po/stats.pot
+++ b/english/po/stats.pot
@@ -3,235 +3,235 @@ msgstr ""
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
-#: ../../stattrans.pl:239
-#: ../../stattrans.pl:243
+#: ../../stattrans.pl:240
+#: ../../stattrans.pl:244
msgid "This translation is too out of date"
msgstr ""
-#: ../../stattrans.pl:241
-#: ../../stattrans.pl:430
+#: ../../stattrans.pl:242
+#: ../../stattrans.pl:438
msgid "Wrong translation version"
msgstr ""
-#: ../../stattrans.pl:245
+#: ../../stattrans.pl:246
msgid "The original is newer than this translation"
msgstr ""
-#: ../../stattrans.pl:248
-#: ../../stattrans.pl:430
+#: ../../stattrans.pl:249
+#: ../../stattrans.pl:438
msgid "The original no longer exists"
msgstr ""
-#: ../../stattrans.pl:406
+#: ../../stattrans.pl:414
msgid "hits"
msgstr ""
-#: ../../stattrans.pl:406
+#: ../../stattrans.pl:414
msgid "hit count N/A"
msgstr ""
-#: ../../stattrans.pl:424
-#: ../../stattrans.pl:425
+#: ../../stattrans.pl:432
+#: ../../stattrans.pl:433
msgid "Click to fetch diffstat data"
msgstr ""
-#: ../../stattrans.pl:439
-#: ../../stattrans.pl:573
-#: ../../stattrans.pl:574
+#: ../../stattrans.pl:447
+#: ../../stattrans.pl:585
+#: ../../stattrans.pl:586
msgid "Unified diff"
msgstr ""
-#: ../../stattrans.pl:441
-#: ../../stattrans.pl:573
-#: ../../stattrans.pl:574
+#: ../../stattrans.pl:449
+#: ../../stattrans.pl:585
+#: ../../stattrans.pl:586
msgid "Colored diff"
msgstr ""
-#: ../../stattrans.pl:540
+#: ../../stattrans.pl:548
msgid "Translation summary for"
msgstr ""
-#: ../../stattrans.pl:543
+#: ../../stattrans.pl:551
msgid "Translated"
msgstr ""
-#: ../../stattrans.pl:543
-#: ../../stattrans.pl:624
-#: ../../stattrans.pl:693
-#: ../../stattrans.pl:739
-#: ../../stattrans.pl:782
+#: ../../stattrans.pl:551
+#: ../../stattrans.pl:636
+#: ../../stattrans.pl:705
+#: ../../stattrans.pl:751
+#: ../../stattrans.pl:794
msgid "Up to date"
msgstr ""
-#: ../../stattrans.pl:543
-#: ../../stattrans.pl:694
-#: ../../stattrans.pl:740
+#: ../../stattrans.pl:551
+#: ../../stattrans.pl:706
+#: ../../stattrans.pl:752
msgid "Outdated"
msgstr ""
-#: ../../stattrans.pl:543
-#: ../../stattrans.pl:695
-#: ../../stattrans.pl:741
-#: ../../stattrans.pl:784
+#: ../../stattrans.pl:551
+#: ../../stattrans.pl:707
+#: ../../stattrans.pl:753
+#: ../../stattrans.pl:796
msgid "Not translated"
msgstr ""
-#: ../../stattrans.pl:544
-#: ../../stattrans.pl:545
-#: ../../stattrans.pl:546
-#: ../../stattrans.pl:547
+#: ../../stattrans.pl:552
+#: ../../stattrans.pl:553
+#: ../../stattrans.pl:554
+#: ../../stattrans.pl:555
msgid "files"
msgstr ""
-#: ../../stattrans.pl:550
-#: ../../stattrans.pl:551
-#: ../../stattrans.pl:552
-#: ../../stattrans.pl:553
+#: ../../stattrans.pl:558
+#: ../../stattrans.pl:559
+#: ../../stattrans.pl:560
+#: ../../stattrans.pl:561
msgid "bytes"
msgstr ""
-#: ../../stattrans.pl:560
+#: ../../stattrans.pl:568
msgid "Note: the lists of pages are sorted by popularity. Hover over the page name to see the number of hits."
msgstr ""
-#: ../../stattrans.pl:565
+#: ../../stattrans.pl:577
msgid "Outdated translations"
msgstr ""
-#: ../../stattrans.pl:567
-#: ../../stattrans.pl:623
+#: ../../stattrans.pl:579
+#: ../../stattrans.pl:635
msgid "File"
msgstr ""
-#: ../../stattrans.pl:569
-#: ../../stattrans.pl:575
+#: ../../stattrans.pl:581
+#: ../../stattrans.pl:587
msgid "Diff"
msgstr ""
-#: ../../stattrans.pl:571
+#: ../../stattrans.pl:583
msgid "Comment"
msgstr ""
-#: ../../stattrans.pl:572
+#: ../../stattrans.pl:584
msgid "Diffstat"
msgstr ""
-#: ../../stattrans.pl:577
+#: ../../stattrans.pl:589
msgid "Log"
msgstr ""
-#: ../../stattrans.pl:578
+#: ../../stattrans.pl:590
msgid "Translation"
msgstr ""
-#: ../../stattrans.pl:579
+#: ../../stattrans.pl:591
msgid "Maintainer"
msgstr ""
-#: ../../stattrans.pl:581
+#: ../../stattrans.pl:593
msgid "Status"
msgstr ""
-#: ../../stattrans.pl:582
+#: ../../stattrans.pl:594
msgid "Translator"
msgstr ""
-#: ../../stattrans.pl:583
+#: ../../stattrans.pl:595
msgid "Date"
msgstr ""
-#: ../../stattrans.pl:590
+#: ../../stattrans.pl:602
msgid "General pages not translated"
msgstr ""
-#: ../../stattrans.pl:591
+#: ../../stattrans.pl:603
msgid "Untranslated general pages"
msgstr ""
-#: ../../stattrans.pl:596
+#: ../../stattrans.pl:608
msgid "News items not translated"
msgstr ""
-#: ../../stattrans.pl:597
+#: ../../stattrans.pl:609
msgid "Untranslated news items"
msgstr ""
-#: ../../stattrans.pl:602
+#: ../../stattrans.pl:614
msgid "Consultant/user pages not translated"
msgstr ""
-#: ../../stattrans.pl:603
+#: ../../stattrans.pl:615
msgid "Untranslated consultant/user pages"
msgstr ""
-#: ../../stattrans.pl:608
+#: ../../stattrans.pl:620
msgid "International pages not translated"
msgstr ""
-#: ../../stattrans.pl:609
+#: ../../stattrans.pl:621
msgid "Untranslated international pages"
msgstr ""
-#: ../../stattrans.pl:614
+#: ../../stattrans.pl:626
msgid "Translated pages (up-to-date)"
msgstr ""
-#: ../../stattrans.pl:621
-#: ../../stattrans.pl:766
+#: ../../stattrans.pl:633
+#: ../../stattrans.pl:778
msgid "Translated templates (PO files)"
msgstr ""
-#: ../../stattrans.pl:622
-#: ../../stattrans.pl:769
+#: ../../stattrans.pl:634
+#: ../../stattrans.pl:781
msgid "PO Translation Statistics"
msgstr ""
-#: ../../stattrans.pl:625
-#: ../../stattrans.pl:783
+#: ../../stattrans.pl:637
+#: ../../stattrans.pl:795
msgid "Fuzzy"
msgstr ""
-#: ../../stattrans.pl:626
+#: ../../stattrans.pl:638
msgid "Untranslated"
msgstr ""
-#: ../../stattrans.pl:627
+#: ../../stattrans.pl:639
msgid "Total"
msgstr ""
-#: ../../stattrans.pl:644
+#: ../../stattrans.pl:656
msgid "Total:"
msgstr ""
-#: ../../stattrans.pl:656
-#: ../../stattrans.pl:807
+#: ../../stattrans.pl:668
+#: ../../stattrans.pl:819
msgid "Created with"
msgstr ""
-#: ../../stattrans.pl:673
+#: ../../stattrans.pl:685
msgid "Translated web pages"
msgstr ""
-#: ../../stattrans.pl:676
+#: ../../stattrans.pl:688
msgid "Translation Statistics by Page Count"
msgstr ""
-#: ../../stattrans.pl:691
-#: ../../stattrans.pl:737
-#: ../../stattrans.pl:781
+#: ../../stattrans.pl:703
+#: ../../stattrans.pl:749
+#: ../../stattrans.pl:793
msgid "Language"
msgstr ""
-#: ../../stattrans.pl:692
-#: ../../stattrans.pl:738
+#: ../../stattrans.pl:704
+#: ../../stattrans.pl:750
msgid "Translations"
msgstr ""
-#: ../../stattrans.pl:719
+#: ../../stattrans.pl:731
msgid "Translated web pages (by size)"
msgstr ""
-#: ../../stattrans.pl:722
+#: ../../stattrans.pl:734
msgid "Translation Statistics by Page Size"
msgstr ""
@@ -251,3 +251,8 @@ msgstr ""
msgid "There are %d strings to translate."
msgstr ""
+#. TRANSLATORS: The first string is hostname of the debian website mirror, second string is date and time.
+#: ../../english/template/debian/stats_tags.wml:23
+msgid "Hit data from %s, gathered %s."
+msgstr ""
+
diff --git a/english/template/debian/stats_tags.wml b/english/template/debian/stats_tags.wml
index 7cf06c4c14d..0c698bf56a0 100644
--- a/english/template/debian/stats_tags.wml
+++ b/english/template/debian/stats_tags.wml
@@ -18,4 +18,8 @@
<: printf "<gettext domain="stats">There are %d strings to translate.</gettext>", %0 :>
</define-tag>
+<define-tag stats_hit_source whitespace="delete">
+# TRANSLATORS: The first string is hostname of the debian website mirror, second string is date and time.
+<: printf "<gettext domain="stats">Hit data from %s, gathered %s.</gettext>", "%0", "%1" :>
+</define-tag>
diff --git a/stattrans.pl b/stattrans.pl
index ff3e22d9af9..9bf108601e1 100755
--- a/stattrans.pl
+++ b/stattrans.pl
@@ -27,14 +27,15 @@ use Webwml::Langs;
use Webwml::TransCheck;
use Webwml::TransIgnore;
use Debian::L10n::Db ('%LanguageList');
+use Net::Domain qw(hostfqdn);
BEGIN {
- $udd_available = 0;
+ $dde_available = 0;
eval {
require JSON;
require LWP::Simple;
LWP::Simple->import;
- $udd_available = 1;
+ $dde_available = 1;
}; if ($@) {
warn "One or more modules required for DDE support failed to load: $@\n";
}
@@ -321,8 +322,10 @@ mkdir ($config{'htmldir'}, 02775) if (! -d $config{'htmldir'});
# Read website hit statistics, if available
my %hits;
+my $hits_hostname;
+my $hits_datetime;
my $file_sorter = sub($$) { $_[0] cmp $_[1] };
-if ($config{'hit_file'} and $config{'hit_file'} =~ m{^(f|ht)tps?://} and ! $udd_available) {
+if ($config{'hit_file'} and $config{'hit_file'} =~ m{^(f|ht)tps?://} and ! $dde_available) {
warn "Disabling fetching of hit data.\n";
$config{'hit_file'} = undef;
}
@@ -332,6 +335,9 @@ if ($config{'hit_file'}) {
my $json = LWP::Simple::get($config{'hit_file'});
if ($json) {
my $perl = JSON::from_json($json, {utf8 => 1});
+ my %metadata = %{$perl->{'m'}};
+ $hits_hostname = $metadata{'hostname'} || undef;
+ $hits_datetime = defined $metadata{'Last-Modified'} ? strftime "%Y-%m-%d %T GMT", gmtime $metadata{'Last-Modified'} : undef;
foreach my $e (@{$perl->{'r'}}) {
my ($count, $url) = @$e;
last if $count < 3; # URLS with 2 or 1 hits are most likely mistakes; let's not waste RAM on them
@@ -341,6 +347,8 @@ if ($config{'hit_file'}) {
warn "Retrieving hit data failed.\n";
}
} else {
+ $hits_hostname = hostfqdn;
+ $hits_datetime = strftime "%Y-%m-%d %T %Z", localtime;
open(HITS, $config{'hit_file'}) or die sprintf("Opening hit file [%s] failed: $!", $config{'hit_file'});
printf "Reading hit file [%s]\n", $config{'hit_file'} if ($config{'verbose'});
foreach my $hit_line (<HITS>) {
@@ -557,7 +565,11 @@ foreach $lang (@search_in) {
# Make the table of content
print HTML "<toc-display/>\n";
if (%hits) {
- print HTML '<p><gettext domain="stats">Note: the lists of pages are sorted by popularity. Hover over the page name to see the number of hits.</gettext></p>'."\n";
+ print HTML '<p><gettext domain="stats">Note: the lists of pages are sorted by popularity. Hover over the page name to see the number of hits.</gettext>';
+ if (defined $hits_hostname and defined $hits_datetime) {
+ printf HTML ' <stats_hit_source "%s" "%s">', $hits_hostname, $hits_datetime;
+ }
+ print HTML "</p>\n";
}
# outputs the content

© 2014-2024 Faster IT GmbH | imprint | privacy policy