/usr/bin/tmx-explode is in libxml-tmx-perl 0.36-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 | #!/usr/bin/perl
# PODNAME: tmx-explode
# ABSTRACT: Explodes tmx files in a file per language
use warnings;
use strict;
use XML::TMX::Reader;
my @files = grep {-f $_} @ARGV;
for my $file (@files) {
print STDERR "exploding $file..";
my $reader = XML::TMX::Reader->new($file);
my $name = $file;
$name =~ s/\.tmx//;
my %fh;
my $i = 1;
$reader->for_tu(
sub {
my ($langs) = @_;
print STDERR "." unless $i % 10;
for my $l (keys %$langs) {
next if $l eq "-prop";
mkdir $l unless -d $l;
$langs->{$l} =~ s/\n/ /g;
$langs->{$l} =~ s/\s+/ /g;
unless ($fh{$l}) {
open $fh{$l}, ">$l/$name";
binmode $fh{$l}, ":utf8";
}
print {$fh{$l}} "$i\t$langs->{$l}\n";
}
++$i;
},
);
close $fh{$_} for (keys %fh);
print STDERR "DONE\n";
}
__END__
=pod
=encoding UTF-8
=head1 NAME
tmx-explode - Explodes tmx files in a file per language
=head1 VERSION
version 0.36
=head1 SYNOPSIS
tmx-explode foo.tmx bar.tmx
# if foo.tmx and bar.tmx have only PT and EN languages, you will get
# \-EN
# \-- foo
# \-- bar
# \-PT
# \-- foo
# \-- bar
=head1 DESCRIPTION
Explodes a set of tmx files, creating a folder per language, and a
file per tmx file.
=head1 AUTHORS
=over 4
=item *
Alberto Simões <ambs@cpan.org>
=item *
José João Almeida <jj@di.uminho.pt>
=back
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2010-2017 by Projeto Natura <natura@di.uminho.pt>.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
|