summaryrefslogtreecommitdiffstats
path: root/tdeabc/scripts/createisomap.pl
blob: 897cd4896517396e651edba1fef02420187c3b4a (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
#!/usr/bin/perl
#
# Create a translation table countryname->iso-code from the entry.desktop
# files in tdebase/l10n/*/
#
# USAGE EXAMPLE:
#     ./createisomap.pl $TDEDIR/share/locale/l10n > countrytransl.map
#
# Don't laugh at me. I put this together with an old perl book, perl
# being a language I've never used before.

@entries = <$ARGV[0]/*/entry.desktop>;
chomp @entries;
foreach $entry (@entries) {
    local ( $entryiso, @entryfile, @mappings );
    # print "--> $entry\n";
    $entryiso = $entry;
    $entryiso =~ s/$ARGV[0]\///;
    $entryiso =~ s/\/entry\.desktop//;
    # print "    $entryiso\n";
    open (IN, $entry);
    @entryfile = <IN>;
    close IN;
    chomp @entryfile;
    foreach $entryfileline (@entryfile) {
        if ( $entryfileline =~ /^Name.*=(.*)$/ ) {
            # push (@mappings, $1 . "\t" . $entryiso );
            print "$1\t$entryiso\n";
        }
    }
}

# add some convenience entries which aren't part of the entry.desktop files

print "Czech Republic\tcz\n";