2000-03-14 23:06:21 +00:00
#!/usr/bin/perl
2000-03-28 21:06:39 +00:00
# a lame attempt at xgettext for scheme
# adapted from pxgettext as found in the plug-ins/perl directory
2000-04-11 16:34:42 +00:00
# TODO:
# proper linenumbers
2000-03-28 23:52:07 +00:00
# There are rumors that perl version 5.005_02 has a bug
2000-03-28 21:06:39 +00:00
# resulting in an endless loop and a memory leak in the
2000-03-28 23:52:07 +00:00
# regex machinery.
#
# It seems to work however. I'll leave this check commented out until
# people report problems.
#
# die ("Your version of Perl (5.005_02) is broken!\nCan't extract the strings from the scripts.\nA lot of messages will be missing from your gimp-script-fu.pot file.\n\n") if $] eq 5.005_02;
2000-03-28 21:06:39 +00:00
undef $/;
2000-04-11 16:34:42 +00:00
my $file;
2000-03-28 21:06:39 +00:00
my $fileposition;
my $e;
my $s;
while (<>) {
$file = $ARGV;
$file =~ s/\.\.\///;
while (/_\(?"((?:[^"\\]+|\\.)*)"\)?/sg) {
2000-04-11 16:34:42 +00:00
my $s = $1;
if ($s =~ /\n/) {
$e = "msgid \"\"\n";
for (split /\n/, $s) {
$e .= "\"$_\\n\"\n";
}
} else {
$e = "msgid \"$s\"\n";
}
$e .= "msgstr \"\"\n";
$fileposition = "#: $file:0\n";
push @{$entry{$e}}, $fileposition;
2000-03-28 21:06:39 +00:00
}
2000-03-14 23:06:21 +00:00
}
2000-03-28 21:06:39 +00:00
foreach $e (sort keys %entry) {
print @{$entry{$e}};
print $e;
print "\n";
2000-03-14 23:06:21 +00:00
}