/[webwml]/webwml/make_all.pl
ViewVC logotype

Contents of /webwml/make_all.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Aug 9 20:33:16 2001 UTC (11 years, 9 months ago) by joy
Branch: MAIN
File MIME type: text/plain
renamed new_translation.pl to make_all.pl, since it does different things; made it make the destination file, not the file in the source directory
1 #!/usr/bin/perl -w
2
3 # Usage: new_translation.pl <file1> <file2>...
4
5 # This will update every version of <file?>, each of which should be
6 # the path to a .wml file (without the language directory).
7
8 # Note: this script old functionality is replaced by touch_old_files.pl
9
10 require 5.001;
11 use strict;
12
13 my (@languages, @parts, $file, $filename, $lang, $path, $pid);
14
15 # from english/template/debian/languages.wml
16 # TODO: Needs to be synced frequently or fixed so it's automatic
17 my %langs = ( english => "en",
18 # arabic => "ar",
19 catalan => "ca",
20 danish => "da",
21 german => "de",
22 greek => "el",
23 esperanto => "eo",
24 spanish => "es",
25 finnish => "fi",
26 french => "fr",
27 croatian => "hr",
28 hungarian => "hu",
29 italian => "it",
30 japanese => "ja",
31 korean => "ko",
32 dutch => "nl",
33 norwegian => "no",
34 polish => "pl",
35 portuguese => "pt",
36 romanian => "ro",
37 russian => "ru",
38 swedish => "sv",
39 turkish => "tr",
40 chinese => "zh",
41 );
42
43 if (!@ARGV) {
44 open SELF, "<$0" or die "Unable to display help: $!\n";
45 HELP: while (<SELF>)
46 {
47 last HELP if (/^require/);
48 s/^# ?//;
49 next if /^!/;
50 print;
51 }
52 exit;
53 }
54
55 opendir(DIR, ".") || die "can't open directory $!";
56 @languages = grep { /^\w+$/ && -d $_ } readdir(DIR);
57 closedir DIR;
58 # print @languages;
59
60 my $relhtmlbase = "../debian.org/";
61
62 foreach $file (@ARGV) {
63 $file =~ s,^english/,,;
64 my $level = 0;
65 my $destfile = "";
66 my @parts = split '/', $file;
67 my $dir = pop @parts;
68 my $path = join '/', @parts;
69 # system ("mkdir -p $relhtmlbase$path");
70 while ($dir) { $destfile .= "../"; $dir = pop @parts; }
71 $destfile .= $relhtmlbase . $file;
72 foreach $lang (@languages) {
73 next if ($lang eq "CVS");
74 if ( -f "$lang/$file" ) {
75 $pid = fork;
76 if ($pid) { # parent
77 # do nothing
78 }
79 else { # child
80 $destfile =~ s/.wml$/.$langs{$lang}.html/;
81 print "Making the " . ucfirst $lang . " copy:\n";
82 system("make -C $lang/$path $destfile") == 0 or die "$!\n";
83 exit 0;
84 }
85 waitpid($pid,0);
86 }
87 else {
88 print "The file isn't translated into " . ucfirst $lang . ".\n";
89 }
90 }
91 }

  ViewVC Help
Powered by ViewVC 1.1.5