1#!/usr/bin/perl
2
3# a lame attempt at xgettext for perl
4# line line numbers, yet
5
6# 5.005_02 in particular seems to have a BIG BUG
7# resulting in an endless loop and a memory leak in the
8# regex machinery :(
9exit 0 unless ( $] >= 5.005_03 || $] <= 5.005 );
10
11undef $/;
12
13print <<'EOF';
14# SOME DESCRIPTIVE TITLE.
15# Copyright (C) YEAR Free Software Foundation, Inc.
16# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
17#
18#, fuzzy
19msgid ""
20msgstr ""
21"Project-Id-Version: gimp-perl 1.14\n"
22"POT-Creation-Date: 1999-09-12 17:58+0200\n"
23"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
24"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
25"Language-Team: LANGUAGE <LL@li.org>\n"
26"MIME-Version: 1.0\n"
27"Content-Type: text/plain; charset=CHARSET\n"
28"Content-Transfer-Encoding: ENCODING\n"
29EOF
30
31while(<>) {
32    while (/(?:N|_)_\(?"((?:[^"\\]+|\\.)*)"\)?/sg) {
33       my $s = $1;
34       my $e = "\n";
35       if ($s =~ /\n/) {
36          $e .= "msgid \"\"\n";
37          for (split /\n/, $s) {
38             $e .= "\"$_\\n\"\n";
39          }
40       } else {
41          $e .= "msgid \"$s\"\n";
42       }
43       $e .= "msgstr \"\"\n";
44       push @{$entry{$e}}, $fileposition;
45    }
46}
47
48print keys %entry;
49
50
51