summaryrefslogtreecommitdiff
path: root/scripts/extract_translators.pl
blob: b233e86fbf6dfd8ffd684ad56e3d0966e68de3aa (plain)
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
#!/usr/bin/env perl

use strict;
use Locale::Language;
use Locale::Country;

my @files = split /\s+/, `ls po/*.po`;
my @files = sort {$a cmp $b} @files;

foreach my $f (@files) {
    open F, "<$f";

    my $code = $f;
    $code =~ s/^po\/(.*)\.po/$1/g;

    my $script;
    if ($code =~ /(.*)@(.*)/) {
        $code = $1;
        $script = $2;
    }
    
    my $country;
    if ($code =~ /(.*)_(.*)/) {
        $code = $1;
        $country = code2country ($2);
    }

    my $lang = code2language($code);
    #print "$code\n";
    print "$lang";
    if ($country) {
        print " ($country)";
    }
    if ($script) {
        print " ($script)";
    }
    print " $code\n";
    while (<F>) {
        if (/^#/) {
            if (/\@/ && !(/Yakovenko/) && !(/EMAIL/)) {
                s/^#//;
                s/, [0-9]+\.$//g;
                chomp;
                print "$_\n";
            }
        }
        else {
            last;
        }
    }
    print "\n";

    close F;
}