81
82
"schemas-style|s" => \$SCHEMAS_STYLE_ARG,
82
83
"rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG,
83
84
"quoted-style" => \$QUOTED_STYLE_ARG,
85
"quotedxml-style" => \$QUOTEDXML_STYLE_ARG,
84
86
"pass-through|p" => \$PASS_THROUGH_ARG,
85
87
"utf8|u" => \$UTF8_ARG,
86
88
"multiple-output|m" => \$MULTIPLE_OUTPUT,
1077
1080
print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG;
1080
open OUTPUT, ">$OUTFILE" or die "Cannot open $OUTFILE: $!\n";
1083
mkdir "C" or -d "C" or die "Cannot create subdirectory C: $!\n";
1085
open OUTPUT, ">C/$OUTFILE" or die "Cannot open C/$OUTFILE: $!\n";
1086
binmode (OUTPUT) if $^O eq 'MSWin32';
1087
my $tree = readXml($FILE);
1088
print_header($FILE, \*OUTPUT);
1089
parseTree(\*OUTPUT, $tree);
1091
print "CREATED C/$OUTFILE\n" unless $QUIET_ARG;
1093
open OUTPUT, ">$OUTFILE" or die "Cannot open $OUTFILE: $!\n";
1094
binmode (OUTPUT) if $^O eq 'MSWin32';
1095
my $tree = readXml($FILE);
1096
print_header($FILE, \*OUTPUT);
1097
parseTree(\*OUTPUT, $tree);
1099
print "CREATED $OUTFILE\n" unless $QUIET_ARG;
1103
sub keys_merge_translation
1107
if ( ! -d $lang && $MULTIPLE_OUTPUT)
1109
mkdir $lang or -d $lang or die "Cannot create subdirectory $lang: $!\n";
1112
open INPUT, "<${FILE}" or die "Cannot open ${FILE}: $!\n";
1113
open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n";
1081
1114
binmode (OUTPUT) if $^O eq 'MSWin32';
1082
my $tree = readXml($FILE);
1083
print_header($FILE, \*OUTPUT);
1084
parseTree(\*OUTPUT, $tree);
1118
if (s/^(\s*)_(\w+=(.*))/$1$2/)
1122
if (!$MULTIPLE_OUTPUT)
1126
my $non_translated_line = $_;
1128
for my $lang (sort keys %po_files_by_lang)
1130
my $translation = $translations{$lang, $string};
1131
next if !$translation;
1133
$_ = $non_translated_line;
1134
s/(\w+)=.*/[$lang]$1=$translation/;
1140
my $non_translated_line = $_;
1141
my $translation = $translations{$lang, $string};
1142
$translation = $string if !$translation;
1144
$_ = $non_translated_line;
1145
s/(\w+)=.*/$1=$translation/;
1086
print "CREATED $OUTFILE\n" unless $QUIET_ARG;
1158
print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG;
1089
1161
sub keys_merge_translations
1091
open INPUT, "<${FILE}" or die;
1092
open OUTPUT, ">${OUTFILE}" or die;
1093
binmode (OUTPUT) if $^O eq 'MSWin32';
1163
if ($MULTIPLE_OUTPUT)
1097
if (s/^(\s*)_(\w+=(.*))/$1$2/)
1103
my $non_translated_line = $_;
1105
for my $lang (sort keys %po_files_by_lang)
1107
my $translation = $translations{$lang, $string};
1108
next if !$translation;
1110
$_ = $non_translated_line;
1111
s/(\w+)=.*/[$lang]$1=$translation/;
1165
for my $lang (sort keys %po_files_by_lang)
1167
keys_merge_translation ($lang);
1169
keys_merge_translation ("C");
1173
keys_merge_translation (".");
1125
1177
sub desktop_merge_translations
1416
1468
sub quoted_translation
1418
my ($lang, $string) = @_;
1470
my ($xml_mode, $lang, $string) = @_;
1472
$string = entity_decode($string) if $xml_mode;
1420
1473
$string =~ s/\\\"/\"/g;
1422
1475
my $translation = $translations{$lang, $string};
1423
1476
$translation = $string if !$translation;
1477
$translation = entity_encode($translation) if $xml_mode;
1425
1478
$translation =~ s/\"/\\\"/g;
1426
1479
return $translation
1429
1482
sub quoted_merge_translations
1484
my ($xml_mode) = @_;
1431
1486
if (!$MULTIPLE_OUTPUT) {
1432
1487
print "Quoted only supports Multiple Output.\n";