First version of french starting guide
[xcsoar.git] / tools / xci2po.pl
blob886ce13bdcf3a3d0d262d4c30f283c4a10dfdabf
1 #!/usr/bin/perl
3 use strict;
5 my $line = 0;
6 my $filename = "";
7 my %msges = ();
9 while ( <@ARGV> ) {
11 open (IN, "< " . $_) or die $!;
12 $filename = $_;
14 ## Process one event file like that:
15 # mode=pan
16 # type=key
17 # data=6
18 # event=Pan off
19 # label=Pan\nOff -> Pick these labals and dump them in pot format,
20 # location=5 except they are $( ) enclosed
21 # ...
22 # event=StatusMessage Simulation\r\nNothing is real!
23 # -> Also pick those messages and dump them into pot format
25 $line = 0;
26 while (<>) {
27 chomp;
28 $line++;
30 next if (/^#/);
32 if (/^label=([^\$]*?[^\$\s])\s*(?:\\n[^[:alpha:]]*)?(?:\$.*)?$/) {
33 my $msg = $1;
34 $msg =~ s,\s*\\[nr]$,,g;
35 $msges{$msg} .= "#: $filename:$line\n";
36 } elsif (/^event=StatusMessage\s+(\S.*\S)\s*$/) {
37 $msges{ $1 } .= "#: $filename:$line\n";
41 close IN;
44 my $k = "";
45 my $v = "";
47 while (($k, $v) = each %msges) {
48 print $v . "msgid \"$k\"\nmsgstr \"\"\n\n";