Permalink
Browse files
TOOLS: PRINCE: Added credits.txt support to the POT file generator
- Loading branch information
Showing
with
57 additions
and
0 deletions.
-
+57
−0
engines/prince/gen-po.pl
|
|
@@ -7,13 +7,16 @@ |
|
|
sub process_inv($); |
|
|
sub process_varia($); |
|
|
sub process_mob($); |
|
|
sub process_credits($); |
|
|
|
|
|
use open qw/:std :utf8/; |
|
|
|
|
|
if ($#ARGV != 0) { |
|
|
die "Usage: $0 <language-code>"; |
|
|
} |
|
|
|
|
|
my %data; |
|
|
|
|
|
my $lang = $ARGV[0]; |
|
|
|
|
|
print <<EOF; |
|
|
@@ -41,6 +44,7 @@ |
|
|
process_inv "invtxt.txt.out"; |
|
|
process_varia "variatxt.txt.out"; |
|
|
process_mob "mob.txt.out"; |
|
|
process_credits "credits.txt.out"; |
|
|
|
|
|
exit; |
|
|
|
|
|
@@ -56,6 +60,8 @@ sub process_inv { |
|
|
|
|
|
/^([\d]+)\.\s+(.*)$/; |
|
|
|
|
|
$data{'invtxt.dat'}{$1} = $2; |
|
|
|
|
|
print <<EOF; |
|
|
|
|
|
#: invtxt.txt:$1 |
|
|
@@ -79,6 +85,8 @@ sub process_varia { |
|
|
|
|
|
/^([\d]+)\.\s+(.*)$/; |
|
|
|
|
|
$data{'variatxt.dat'}{$1} = $2; |
|
|
|
|
|
print <<EOF; |
|
|
|
|
|
#: variatxt.txt:$1 |
|
|
@@ -113,6 +121,8 @@ sub process_mob { |
|
|
|
|
|
$line++; |
|
|
|
|
|
$data{'mob.lst'}{$n} = $_; |
|
|
|
|
|
print <<EOF; |
|
|
|
|
|
#: mob.lst:$n |
|
|
@@ -123,3 +133,50 @@ sub process_mob { |
|
|
|
|
|
close IN; |
|
|
} |
|
|
|
|
|
sub process_credits { |
|
|
my $file = shift; |
|
|
|
|
|
open(*IN, $file) or die "Cannot open file $file: $!"; |
|
|
|
|
|
my $n = 0; |
|
|
my $line = 0; |
|
|
my $str = ""; |
|
|
|
|
|
while (<IN>) { |
|
|
chomp; |
|
|
|
|
|
next if $_ eq 'credits.txt'; |
|
|
|
|
|
$line++; |
|
|
$str .= "\"$_\\n\"\n"; |
|
|
|
|
|
if ($line == 10) { |
|
|
$data{'credits.txt'}{$n} = $str; |
|
|
|
|
|
$n++; |
|
|
$line = 0; |
|
|
|
|
|
print <<EOF; |
|
|
|
|
|
#: credits.txt:$n |
|
|
msgid "" |
|
|
$str |
|
|
msgstr "" |
|
|
EOF |
|
|
|
|
|
$str = ""; |
|
|
} |
|
|
} |
|
|
|
|
|
$data{'credits.txt'}{$n} = $str; |
|
|
|
|
|
print <<EOF; |
|
|
|
|
|
#: credits.txt:$n |
|
|
msgid "" |
|
|
${str}msgstr "" |
|
|
EOF |
|
|
|
|
|
close IN; |
|
|
} |