aboutsummaryrefslogtreecommitdiffstats
path: root/new_translation.pl
blob: 92bef58deb8d6c6c74481ac5abb5a6efb49e9fc5 (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
#!/usr/bin/perl -w

require 5.001;
use strict;

my (@languages, @parts, $file, $filename, $lang, $path, $pid);

if (!@ARGV) {
   print "Usage: new_translation.pl <file1> <file2>...\n";
   print "\tThis will update every version of <file?> so that they\n";
   print "\tknow about the new translation. Each <file?> should be\n";
   print "\tthe path to a .wml file (without the language directory).\n";
   exit 1;
}

opendir(DIR, ".") || die "can't open directory $!";
@languages = grep { /^\w+$/ && -d $_ } readdir(DIR);
closedir DIR;
# print @languages;

foreach $file (@ARGV) {
   foreach $lang (@languages) {
      if ($lang eq "CVS") { next; }
      @parts = split ?\/?,$file;
      $filename = pop(@parts);
      $path = join('/', @parts);
      if ( -f "$lang/$file" ) {
			if ($path eq '') {
         	print "running 'wml -q $lang/$filename'\n";
			}
			else {
         	print "running 'wml -q $lang/$path/$filename'\n";
			}
         $pid = fork;
         if ($pid) { # parent
            # do nothing
         }
         else {      # child
            chdir "$lang/$path" && system("wml", "-q", $filename);
            exit 0;
         }
         waitpid($pid,0);
      }
      else {
			if ($path eq '') {
         	print "$lang/$file doesn't exist\n";
			}
			else {
         	print "$lang/$path/$file doesn't exist\n";
			}
      }
   }
}

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