This file is indexed.

/usr/bin/tmxsplit is in libxml-tmx-perl 0.31-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/usr/bin/perl -s

use strict;
use utf8;
use XML::DT;
#use bytes;

our ($twente,$latin1,$utf8,$q,$cutmaxlen);

my $filename = $ARGV[0];

my %files;
my $data;
my %h = (
	 # '-outputenc' => "ISO-8859-1",
	 'seg' => sub{
	   for ($c){
	     # s/\&/\&/g;
	     # s/</\&lt;/g;
	     # s/>/\&gt;/g;
	     s/\s\s+|^\s+|\s+$/ /g;
	   };
	   $c
	 },
	 'ut'  => sub{" "},
	 'tu'  => sub{$c},
	 'tuv' => sub{
	   $c =~ s/^[\s\n]*//;
	   $c =~ s/[\s\n]*$//;
	   $data->{$v{lang}||$v{"xml:lang"}} = 
	     $cutmaxlen && length($c) > $cutmaxlen 
	       ? substr($c,0,$cutmaxlen)."||" : $c},
	);

$h{-outputenc} = "ISO-8859-1" if $twente || $latin1;
undef $h{-outputenc} if $utf8;

my $i = 0;
$| = 1;
my $f;
for $f (@ARGV){
  #  print "\n$f" unless $q;
  print STDERR "\n$f";
  $/ = "\n";
  open X, $f or die "cannot open file $f";
  do {
    if(/encoding=.ISO-8859-1./i){$h{-outputenc}=$h{-inputenc}="ISO-8859-1";}
  } while ($_ = <X> and $_ !~ /<body\b/);

  my $resto = "";
  m!<body.*?>!s and $resto = $';
  $/ = "</tu>";

  while(<X>) {
    ($_ = $resto . $_ and $resto = "" ) if $resto; 
    $i++;
    last if /<\/body>/;
    #print "." if (!$q && $i%500==0);
    print STDERR "." if ($i % 1000==0);
    s/\>\s+/>/;
    undef($data);
    eval {dtstring($_, %h)} ; ## don't die in invalid XML
    if($@){warn($@)}
    else{
      for my $k (keys %$data) {
        if (exists($files{"$filename-$k"})) {
	  myprint($files{"$filename-$k"}, $data->{$k},$i);
        } else {
          my $x;
          open $x, ">$filename-$k" or die("cant >$filename-$k\n");
          binmode($x,":utf8") if $utf8;
          myprint($x, $data->{$k},$i);
          $files{"$filename-$k"} = $x;
        }
      }
    }
  }
  close X;
}

for my $key (keys %files) {
  print "$key\n";
}

sub myprint{
  my($f,$tu,$i)=@_;
  if ($twente){
    for ($tu){
      s/<.*?>/ /gs;
      s/[\|\$]/ /gs;
      s/(\w)([.;,!:?«»"])/$1 $2/g;
      s/([.;,!:?«»"])(\w)/$1 $2/g;
      s/\s\s+|^\s+|\s+$/ /g;
    }
    print {$f} "$tu\n\$\n";
  } else {
    print {$f} "<tu id=\"$i\">$tu</tu>\n";
  }
}

__END__

=encoding utf-8

=head1 NAME

tmxsplit - splits a TMX file several files, one for each language

=head1 SYNOPSIS

 tmxsplit f.tmx f2.tmx ...
 tmxsplit -twente f.tmx

=head1 DESCRIPTION

splits a TMX file in several files (one per language) and puts
a tag C<tu id=...> in each translation unit.

The names for output files is based on the first tmx file supplied.

=head1 Options

 -twente  -- makes a format compatible with twente-aligner

 -latin1  -- a make latin1-encoded output
 -utf8    -- a make   utf8-encoded output

 -q       -- don't print filenames and "."

 -cutmaxlen=n -- cut translations by the n character

=head1 AUTHOR

Alberto Simões, albie@di.uminho.pt

J.Joao Almeida, jj@di.uminho.pt

=head1 SEE ALSO

perl(1).

tmx2cqp(1)

=cut