/[debian-l10n]/dl10n/trunk/dl10n-html
ViewVC logotype

Contents of /dl10n/trunk/dl10n-html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1033 - (hide annotations) (download)
Wed May 28 21:54:29 2008 UTC (5 years ago) by nekral-guest
File size: 5915 byte(s)
Ask for comments to be sent to debian-l10n-devel@lists.alioth.debian.org
rather than to Thomas.
1 thuriaux-guest 392 #!/usr/bin/perl -w
2    
3     use strict;
4     use utf8;
5    
6    
7     =head1 NAME
8    
9     dl10n-spider -- crawl translator mailing lists (and BTS) for status updates
10    
11     =head1 SYNOPSIS
12    
13     dl10n-spider [options] lang+
14    
15     =head1 DESCRIPTION
16    
17     This script parses the debian-l10n-E<lt>languageE<gt> mailing list
18     archives. It looks for emails which title follow a specific format
19     indicating what the author intend to translate, or the current status of
20     his work on this translation.
21    
22     Those informations are saved to a dl10n database which can then be used to
23     build a l10n coordination page or any other useless statistics.
24    
25     =cut
26    
27     use Getopt::Long; #to parse the args
28     use LWP::UserAgent;
29     use Debian::L10n::Html;
30 thuriaux-guest 539 use File::Path;
31 nekral-guest 1030 use POSIX qw(strftime);
32 thuriaux-guest 392
33    
34     my $progname = $0;
35     $progname = $1 if $progname =~ m,([^/])+$,;
36    
37     my $VERSION = "4.0"; # External Version Number
38     my $BANNER = "Debian l10n infrastructure -- mailing list spider v$VERSION"; # Version Banner - text form
39    
40     my $cmdline_year = undef;
41     my $cmdline_month = undef;
42     my $cmdline_msg = undef;
43     my $cmdline_file = undef;
44    
45     my %Language = (
46 thuriaux-guest 551 ar => 'arabic',
47     ca => 'catalan',
48     de => 'german',
49 thuriaux-guest 762 en => 'english',
50 thuriaux-guest 551 es => 'spanish',
51 thuriaux-guest 392 fr => 'french',
52 thuriaux-guest 551 nl => 'dutch',
53     pt => 'portuguese',
54 thuriaux-guest 553 tr => 'turkish',
55 thuriaux-guest 762 all => 'all',
56 thuriaux-guest 392 );
57    
58    
59     =head1 Command line option parsing
60    
61     =over4
62    
63     =item General options:
64    
65     =over4
66    
67     =item -h, --help
68    
69     display short help text
70    
71     =item -V, --version
72    
73     display version and exit
74    
75     =back
76    
77     =item Begin point of the crawling:
78    
79     =over4
80    
81     =item --year=YYYY
82    
83     =item --month=MM
84    
85     =item --message=msg
86    
87     =back
88    
89     if not specified, will crawl for new messages.
90    
91     =item Database to fill:
92    
93     =over4
94    
95     =item --sdb=STATUS_FILE
96    
97     use STATUS_FILE as status file (instead of $STATUS_FILE)
98    
99     =back
100    
101     =back
102    
103     =cut
104    
105     # This is put into a block to avoid main namespace pollution
106     {
107     sub syntax_message {
108     my $message = shift;
109     if (defined $message) {
110     print "$progname: $message\n";
111     } else {
112     print "$BANNER\n";
113     }
114     print <<EOF
115     Syntax: $0 [options] [lang]+
116     General options:
117     -h, --help display short help text
118     -V, --version display version and exit
119    
120     Database to fill:
121     --sdb=STATUS_FILE use STATUS_FILE as status file
122     EOF
123     ;
124    
125     if (defined $message) {
126     exit 1;
127     } else {
128     exit 0;
129     }
130     }
131    
132    
133     # Display Version Banner
134     # Options: -V|--version, --print-version
135     sub banner {
136     if ($_[0] eq 'print-version') {
137     print "$VERSION\n";
138     } else {
139     print "$BANNER\n";
140     }
141     exit 0;
142     }
143    
144     # Hash used to process commandline options
145     my %opthash = (
146     # ------------------ general options
147     "help|h" => \&syntax_msg,
148     "version|V" => \&banner,
149    
150     # ------------------ configuration options
151     "sdb=s" => \$cmdline_file,
152     );
153    
154    
155     # init commandline parser
156     Getopt::Long::config('bundling', 'no_getopt_compat', 'no_auto_abbrev');
157    
158     # process commandline options
159     GetOptions(%opthash)
160     or syntax_msg("error parsing options");
161     }
162    
163    
164 thuriaux-guest 551 my $lang = $ARGV[0];
165     my $language = $Language{$lang};
166 thuriaux-guest 392
167 thuriaux-guest 551 Html::html($cmdline_file, $lang);
168 thuriaux-guest 392
169     {
170     my $head = <<EOF
171     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
172 thuriaux-guest 551 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$lang" lang="$lang">
173 thuriaux-guest 392
174     <head>
175 thuriaux-guest 551 <title>Coordination of debian-l10n-$language</title>
176 thuriaux-guest 723 <link href="../l10n.css" rel="stylesheet" />
177 thuriaux-guest 392 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
178     <meta name="Copyright" content="Copyright (C) 2004 Nicolas Bertolissio" />
179     </head>
180    
181     <body>
182    
183 thuriaux-guest 476 <p style="text-align:center;">
184     <a href="http://www.debian.org/"><img src="http://www.debian.org/logos/openlogo-nd-50.png" style="border:0; width:50px; height:61px;" alt="" /></a>
185     <a href="http://www.debian.org/"><img src="http://www.debian.org/Pics/debian.jpg" style="border:0; width:179px; height:61px;" alt="Debian Project" /></a>
186     </p>
187 thuriaux-guest 392
188 thuriaux-guest 551 <h1>Coordination of debian-l10n-$language</h1>
189 thuriaux-guest 392
190     <p>
191     This page is made to aid the coordination of translating debian related text to
192 thuriaux-guest 723 $language. As documented <a href='../pseudo-urls.html'>here</a>, translators and
193 thuriaux-guest 551 reviewers use pseudo-urls in the subject of e-mails to the debian-l10n-$language
194 thuriaux-guest 428 list for coordination.
195 thuriaux-guest 392 </p>
196    
197     <p>
198     A program parses these pseudo-urls and collects the relevant data, which are
199     then displayed below.
200     </p>
201    
202     EOF
203     ;
204 nekral-guest 1030 my $date = strftime('%a, %d %b %Y %H:%M:%S %z', gmtime);
205 thuriaux-guest 392 my $tail = <<EOF
206    
207 thuriaux-guest 476 <hr />
208 thuriaux-guest 392
209     <p>
210 nekral-guest 1033 <small>Comments:
211     <a href='mailto:debian-l10n-devel@lists.alioth.debian.org'>Debian L10N
212     Development Team</a></small>
213 thuriaux-guest 392 </p>
214 nekral-guest 1030 <p>
215     <small>Generated on $date</small>
216     </p>
217 thuriaux-guest 392
218     </body>
219 thuriaux-guest 476 </html>
220 thuriaux-guest 392 EOF
221     ;
222    
223     opendir D, './include' or die "Cannot open .: $!";
224     my @files = readdir D;
225     closedir D;
226 thuriaux-guest 539 mkpath ("html/include", 02775) or die "Cannot create include directory\n" unless (-d "html/include");
227 thuriaux-guest 392
228 thuriaux-guest 553 foreach (grep (/^$lang\./, @files)) {
229 thuriaux-guest 392 next unless /\.inc$/;
230     s/\.inc$//;
231     open I, "<include/$_.inc" or die "Cannot open $_.inc: $!";
232     my @inc = <I>;
233     close I;
234     open I, ">html/include/$_.inc" or die "Cannot open $_.inc $_";
235     print I @inc;
236     close I;
237 thuriaux-guest 721 open H, ">html/$Language{$lang}/$_.html" or die "Cannot open $_.html: $_";
238 thuriaux-guest 392 print H $head;
239     print H @inc;
240     print H $tail;
241     close H;
242     }
243     }
244    
245    
246     =head1 LICENSE
247    
248     This program is free software; you can redistribute it and/or modify it under
249     the terms of the GNU General Public License as published by the Free Software
250     Foundation; either version 2 of the License, or (at your option) any later
251     version.
252    
253     This program is distributed in the hope that it will be useful, but WITHOUT ANY
254     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
255     PARTICULAR PURPOSE. See the GNU General Public License for more details.
256     # You should have received a copy of the GNU General Public License
257     along with this program; if not, write to the Free Software Foundation, Inc.,
258     59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
259    
260     =head1 COPYRIGHT (C)
261    
262     2003,2004 Tim Dijkstra
263     2004 Nicolas Bertolissio
264     2004 Martin Quinson
265    
266     =cut
267    
268     1;

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5