File: stdout2pot

package info (click to toggle)
menu-l10n 0.20101027
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,452 kB
  • ctags: 19
  • sloc: sh: 467; makefile: 58; perl: 35
file content (45 lines) | stat: -rwxr-xr-x 1,275 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl -w

open (MENU,"-|","update-menus --stdout --nodpkgcheck --nodefaultdirs --menufilesdir ./usr/lib/menu/ --menufilesdir ./usr/share/menu/") or die("update-menus");

while (<MENU>){
  /^!F (.*)/ and do {@file=split("/",$1); $file=$file[$#file]; next};
  /^!/ and next;
  $menu=$_;
  while ($menu =~ m/([^ ]+)=("(?:[^"\\]|\\[^"])*")(.*)/)
  {
    $field="$1";$value="$2";$menu="$3";
    ($field eq "title" || $field eq "longtitle") && do
    { 
       $key=defined($items{$value})?$items{$value}:"";
       $key.="#: package $file, field $field:\n";
       $items{$value}=$key;
    };
  }
}

use POSIX qw(strftime);
my @date=localtime(time);
my $date=strftime ("%Y-%d-%m %H:%M %z",@date);

print "# Collection of titles/longtitles of Debian menu.
# This file is automatically generated. Do not edit.
#
#, fuzzy
msgid \"\"
msgstr \"\"
\"Project-Id-Version: menu VERSION\\n\"
\"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\\n\"
\"PO-Revision-Date: $date\\n\"
\"Last-Translator: FULL NAME <e-mail\@address>\\n\"
\"MIME-Version: 1.0\\n\"
\"Content-Type: text/plain; charset=CHARSET\\n\"
\"Content-Transfer-Encoding: ENCODING\\n\"

";

for my $s (sort {$items{$a} cmp $items{$b}} keys %items){
    print $items{$s};
    print "msgid $s\n";
    print "msgstr \"\"\n\n";
}