3 # copied from webwml/english/po/wmlxgettext.pl and
4 # changed to a crude intltool replacement
5 # Copyright © 2002-2003 Denis Barbier <barbier@debian.org>
6 # Copyright © 2007 Frank Lichtenheld <frank@lichtenheld.de>
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
32 open(IN, "<", $file) || die "Unable to open $file\n";
38 while (/^(\S+):\s*(.*)\s*$/mg) {
39 my ($key, $value) = ($1, $2);
40 $value =~ s/\377/\n /g;
41 $key =~ tr [A-Z] [a-z];
44 next unless $data{description};
47 $comment = "Facet: $data{facet}";
48 } elsif ($data{tag}) {
49 $comment = "Tag: $data{tag}";
51 die "Neither Facet nor Tag found.";
54 my ($short, $long) = split /\n/, $data{description}, 2;
56 $short = escape($short);
57 push (@msgids, $short);
58 push (@{$messages->{$short}}, $comment.", short desc", $file);
61 $long = escape($long);
62 push (@msgids, $long);
63 push (@{$messages->{$long}}, $comment.", long desc", $file);
73 print "msgid \"\"\nmsgstr \"\"\n".
74 "\"Content-Type: text/plain; charset=UTF-8\\n\"\n".
75 "\"Content-Transfer-Encoding: 8bit\\n\"\n\n";
77 foreach my $msgid (@msgids) {
78 next unless $messages->{$msgid};
79 while (@{$messages->{$msgid}}) {
80 $_ = shift(@{$messages->{$msgid}});
82 print "#. ".$_."\n" if $_;
83 print "#: ".shift(@{$messages->{$msgid}})."\n";
85 print "msgid \"$msgid\"\nmsgstr \"\"\n\n";
86 undef $messages->{$msgid};