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;
33 open(IN, "<", $file) || die "Unable to open $file\n";
39 while (/^(\S+):\s*(.*)\s*$/mg) {
40 my ($key, $value) = ($1, $2);
41 $value =~ s/\377/\n /g;
42 $key =~ tr [A-Z] [a-z];
45 next unless $data{description};
48 $comment = "Facet: $data{facet}";
49 } elsif ($data{tag}) {
50 $comment = "Tag: $data{tag}";
52 die "Neither Facet nor Tag found.";
55 my ($short, $long) = split /\n/, $data{description}, 2;
57 $short = escape($short);
58 push (@msgids, $short);
59 push (@{$messages->{$short}}, $comment.", short desc", $file);
62 $long = escape($long);
64 push (@msgids, $long);
65 push (@{$messages->{$long}}, $comment.", long desc", $file);
75 print "msgid \"\"\nmsgstr \"\"\n".
76 "\"Content-Type: text/plain; charset=UTF-8\\n\"\n".
77 "\"Content-Transfer-Encoding: 8bit\\n\"\n\n";
79 foreach my $msgid (@msgids) {
80 next unless $messages->{$msgid};
81 while (@{$messages->{$msgid}}) {
82 $_ = shift(@{$messages->{$msgid}});
84 print "#. ".$_."\n" if $_;
85 print "#: ".shift(@{$messages->{$msgid}})."\n";
87 print "msgid \"$msgid\"\nmsgstr \"\"\n\n";
88 undef $messages->{$msgid};