#! /usr/local/bin/perl # -*- Perl -*- # Copyright (C) 2000 Motoyuki Kasahara # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. %messages = (); $line = ''; while (<>) { chop if /\n/; if (s/\\$//) { $line .= $_; next; } $line .= $_; &parse_line($line); $line = ''; } &parse_line($line) if ($line ne ''); sub parse_line { local($line) = $_[0]; local($id); while ($line =~ s/\[_ \"([^\"]*)\"\]// || $line =~ s/\[__ [^ ]+ \"([^\"]*)\"\]//) { $id = $1; if (!defined($messages{$id})) { $messages{$id} = 1; print "msgid:$id\n"; print "msgstr:\n"; print "\n"; } } }