File: po2templates

package info (click to toggle)
cdebconf 0.227
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,552 kB
  • sloc: ansic: 16,568; sh: 549; makefile: 456; sql: 52; perl: 13
file content (20 lines) | stat: -rwxr-xr-x 655 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /usr/bin/perl

#   This script is called from src/modules/frontend/Makefile
#   to transform PO files (generated by xgettext on regular
#   C files) into debconf templates files.

$/="\n\n";
my $first = 1;
while (<>) {
        s/"\n"//g;
        my ($pre, $name, $descr) = m/(.*)msgid "([^\n]+)"\nmsgid_plural "([^\n]+)"/s;
        print "\n" unless $first;
        $first = 0;
        print "Template: $name\n";
        print "Type: text\n";
        $pre =~ s/^#[,:].*//mg;
        print "# $pre\n" if $pre =~ s/.*#\. ([^\n]+)\n*$/$1/s;
        #$descr = '"'.$descr.'"' if $descr =~ m/\s$/ && $descr !~ m/"/;
        print "_Description: $descr\n";
}