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.
21 $text =~ s/\n\s*\.\n\s?/\\n/g;
34 open(IN, "<", $file) || die "Unable to open $file\n";
40 while (/^(\S+):\s*(.*)\s*$/mg) {
41 my ($key, $value) = ($1, $2);
42 $value =~ s/\377/\n /g;
43 $key =~ tr [A-Z] [a-z];
46 next unless $data{description};
49 $comment = "Facet: $data{facet}";
50 } elsif ($data{tag}) {
51 $comment = "Tag: $data{tag}";
53 die "Neither Facet nor Tag found.";
56 my ($short, $long) = split /\n/, $data{description}, 2;
58 $short = escape($short);
59 push (@msgids, $short);
60 push (@{$messages->{$short}}, $comment.", short desc", $file);
63 $long = escape($long);
65 push (@msgids, $long);
66 push (@{$messages->{$long}}, $comment.", long desc", $file);
76 print "msgid \"\"\nmsgstr \"\"\n".
77 "\"Content-Type: text/plain; charset=UTF-8\\n\"\n".
78 "\"Content-Transfer-Encoding: 8bit\\n\"\n\n";
80 foreach my $msgid (@msgids) {
81 next unless $messages->{$msgid};
82 while (@{$messages->{$msgid}}) {
83 $_ = shift(@{$messages->{$msgid}});
85 print "#. ".$_."\n" if $_;
86 print "#: ".shift(@{$messages->{$msgid}})."\n";
88 print "msgid \"$msgid\"\nmsgstr \"\"\n\n";
89 undef $messages->{$msgid};