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

Contents of /dl10n/trunk/dl10n-html

Parent Directory Parent Directory | Revision Log Revision Log


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

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.5