blob: 5ebd8bbcb35d27f7d1a047378cfe8c92274166c1 (
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
|
#!/usr/bin/perl
#
# xgettext doesn't deal with TT files, but xgettext.pl doesn't find nget()s, sigh.
# This will find the nget()s and output a .po file excerpt.
use File::Find qw/find/;
my %out;
find( sub {
next unless -f;
next if $File::Find::name =~ /ttc$/;
open (FP, $_) or die $!;
while (<FP>) {
next unless /nget/;
my $line = $.;
my $text = $_;
do {
$text .= <FP>;
} until $text =~ /\)/;
if ($text =~ /nget\(\s*"(.*?)"\s*,\s*"(.*?)"\s*,\s*(.*?)\s*\)/s) {
$out{$1} = {
file => $File::Find::name,
line => $line,
s => $1,
p => $2,
};
}
}
close FP;
}, 'templates', 'perllib');
foreach (values %out) {
print <<EOF;
#: $_->{file}:$_->{line}
#, perl-format
msgid "$_->{s}"
msgid_plural "$_->{p}"
msgstr[0] ""
msgstr[1] ""
EOF
}
|