| 1 |
#!/usr/bin/perl -s |
| 2 |
|
| 3 |
# ABSTRACT: Gives statistics about tmx file. |
| 4 |
# PODNAME: tmxwc |
| 5 |
|
| 6 |
our($h); |
| 7 |
use XML::TMX::Reader; |
| 8 |
|
| 9 |
my $TTU = 0; |
| 10 |
my $n = scalar(@ARGV); |
| 11 |
|
| 12 |
for my $file (@ARGV) { |
| 13 |
my $tm = XML::TMX::Reader->new($file); |
| 14 |
|
| 15 |
my $TU = 0; |
| 16 |
$tm->for_tu({-raw => 1 }, |
| 17 |
sub { $TU++ ; |
| 18 |
print STDERR "\r$TU..." unless $TU%1000; |
| 19 |
} |
| 20 |
); |
| 21 |
print (($h?"":"$file: "),"$TU tu.\n"); |
| 22 |
$TTU += $TU; |
| 23 |
} |
| 24 |
|
| 25 |
print "total: $TTU tu.\n" if $n > 1; |
| 26 |
|
| 27 |
__END__ |
| 28 |
|
| 29 |
=pod |
| 30 |
|
| 31 |
=encoding utf-8 |
| 32 |
|
| 33 |
=head1 NAME |
| 34 |
|
| 35 |
tmxwc - Gives statistics about tmx file. |
| 36 |
|
| 37 |
=head1 VERSION |
| 38 |
|
| 39 |
version 0.39 |
| 40 |
|
| 41 |
=head1 SYNOPSIS |
| 42 |
|
| 43 |
tmxwc tmx1 [tmx2 ...] |
| 44 |
|
| 45 |
-h don't print filenames (default: print filenames) |
| 46 |
|
| 47 |
=head1 DESCRIPTION |
| 48 |
|
| 49 |
Gives statistical information about TMX files like the number of |
| 50 |
translation units. |
| 51 |
|
| 52 |
=head1 AUTHORS |
| 53 |
|
| 54 |
=over 4 |
| 55 |
|
| 56 |
=item * |
| 57 |
|
| 58 |
Alberto Simões <[email protected]> |
| 59 |
|
| 60 |
=item * |
| 61 |
|
| 62 |
José João Almeida <[email protected]> |
| 63 |
|
| 64 |
=back |
| 65 |
|
| 66 |
=head1 COPYRIGHT AND LICENSE |
| 67 |
|
| 68 |
This software is copyright (c) 2010-2017 by Projeto Natura <[email protected]>. |
| 69 |
|
| 70 |
This is free software; you can redistribute it and/or modify it under |
| 71 |
the same terms as the Perl 5 programming language system itself. |
| 72 |
|
| 73 |
=cut |