aboutsummaryrefslogtreecommitdiffstats
path: root/make_all.pl
blob: bc1413bb5c64fb2fdd519f74511d86d35ac2a818 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/perl -w

# Usage: make_all.pl <file1> <file2>...

# 	This will update every version of <file?>, each of which should be
#	the path to a .wml file (without the language directory).

# Note: this script was previously known as new_translation.pl.
# That functionality is replaced by touch_old_files.pl.

require 5.001;
use strict;

# This module resides under webwml/Perl
use lib ($0 =~ m|(.*)/|, $1 or ".") ."/Perl";
use Webwml::Langs;

my $l = Webwml::Langs->new();
my %langs = $l->name_iso();
my @languages = $l->names();

if (!@ARGV) {
  open SELF, "<$0" or die "Unable to display help: $!\n";
  HELP: while (<SELF>)
  {
    last HELP if (/^require/);
    s/^# ?//;
    next if /^!/;
    print;
  }
  exit;
}

foreach my $file (@ARGV) {
  $file =~ s,^english/,,;
  my $path = ""; my $filename = $file;
  if ($file =~ m,(.*)/([^/]+)$,) { $path = $1; $filename = $2; };
  foreach my $lang (@languages) {
      if ( -f "$lang/$file" ) {
         my $pid = fork;
         if ($pid) { # parent
            # do nothing
         }
         else {      # child
            print "Making the " . ucfirst $lang . " copy:\n";
            system("make -C $lang/$path -W $filename install SUBS="); # no need to handle make's errors
            exit 0;
         }
         waitpid($pid,0);
      }
      else {
         print "The file isn't translated into " . ucfirst $lang . ".\n";
      }
  }
}

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