Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src_of_m4loc/tmx/tmx2txt.pl
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@
open(SRCOUT,">:utf8",$outBase.".".$srcLang) || die "Cannot open source output file: $outBase.$srcLang";
open(TGTOUT,">:utf8",$outBase.".".$tgtLang) || die "Cannot open target output file: $outBase.$tgtLang";

# Cannot use the for_tu interface here - process will run out of memory on larger files
$reader->for_tu2(sub{
$reader->for_tu(sub{
my $tu = shift;
if(exists($$tu{$srcLang}) && exists($$tu{$tgtLang})) {
if(exists($$tu{$srcLang}{'-seg'}) && exists($$tu{$tgtLang}{'-seg'})) {
# Necessary as some tu's can contain newlines
my $srcText = $$tu{$srcLang};
my $tgtText = $$tu{$tgtLang};
my $srcText = $$tu{$srcLang}{'-seg'};
my $tgtText = $$tu{$tgtLang}{'-seg'};
# Workaround for bug in XML::TMX::Reader
$srcText =~ s/ARRAY\(.*?\)/$replace/g;
$srcText =~ s/<ut>.*?<\/ut>/$replace/g;
Expand Down