1#!/usr/local/bin/perl -w
2
3use strict;
4
5use Data::Dumper;
6
7my $lang = shift @ARGV;
8my $separator = quotemeta ('||qg::fd||');
9
10my $in_msgid = 1;
11my $text = '';
12my $msgid = '';
13my $LANGUAGES;
14
15while (<STDIN>)
16{
17   my $separated = 0;
18   if (/^(.*)$separator$/)
19   {
20      $text .= $1;
21      $separated = 1;
22   }
23   else
24   {
25      $text .= $_;
26   }
27   #print STDERR "  --> ($separated) ($in_msgid)\n";
28   if ($separated)
29   {
30      if ($in_msgid)
31      {
32         $msgid = $text;
33         $in_msgid = 0;
34      }
35      else
36      {
37         #print "\n$msgid === $text|\n";
38         #$LANGUAGES->{$lang}->{$msgid} = $text if ($text !~ /^Project-Id-Version/);
39         $LANGUAGES->{$lang}->{$msgid} = $text if ($msgid ne '');
40         $in_msgid = 1;
41      }
42      $text = '';
43   }
44}
45
46$Data::Dumper::Sortkeys = 1;
47print "# Automatically generated file. Edit the .po file instead.\n";
48print "" . Data::Dumper->Dump([$LANGUAGES->{$lang}], [ "LANGUAGES->{'$lang'}" ]);
49