SYNOPSIS

   use XML::TMX::Reader;

   my $reader = XML::TMX::Reader->new( $filename );

   $reader -> for_tu( sub {
       my $tu = shift;
       #blah blah blah
   });

   @used_languages = $reader->languages;

   $reader->to_html()

DESCRIPTION

This module provides a simple way for reading \s-1TMX\s0 files.

METHODS

The following methods are available: This method creates a new XML::TMX::Reader object. This process checks for the existence of the file and extracts some meta-information from the \s-1TMX\s0 header;

my $reader = XML::TMX::Reader->new("my.tmx"); This method is used to set the flag to ignore (or not) markup inside translation unit segments. The default is to ignore those markup.

If called without parameters, it sets the flag to ignore the markup. If you don't want to do that, use

$reader->ignore_markup(0); This method returns the languages being used on the specified translation memory. Note that the module does not check for language code correctness or existence. Use \*(C`for_tu\*(C' to process all translation units from a \s-1TMX\s0 file. This version iterates for all tu (one at the time)

The configuration hash is a reference to a Perl hash. At the moment these are valid options: Set this option to a true value and a counter of the number of processed translation units will be printed to stderr. Filename to output the changed \s-1TMX\s0 to. Note that if you use this option, your function should return a hash reference where keys are language names, and values their respective translation. Write at most \*(C`gen_tu\*(C' TUs Process at most \*(C`proc_tu\*(C' TUs Only process \s-1TU\s0 that match \*(C`patt\*(C'. Pass the \s-1XML\s0 directly to the method instead of parsing it. Use segment contents verbatim, without any normalization. A hashref of properties to be added to the \s-1TMX\s0 header block. An arrayref of notes to be added to the \s-1TMX\s0 header block. A boolean value. If set to true, the heading tags (and closing tag) of the \s-1TMX\s0 file are written. Otherwise, only the translation unit tags are written.

The function will receive two arguments:

  • a reference to a hash which maps: the language codes to the respective translation unit segment; a special key \*(L"-prop\*(R" that maps property names to properties; a special key \*(L"-note\*(R" that maps to a list of notes.

  • a reference to a hash which contains the attributes for those translation unit tag;

If you want to process the \s-1TMX\s0 and return it again, your function should return an hash reference where keys are the languages, and values their respective translation. Use this method to create a nice \s-1HTML\s0 file with the translation memories. Notice that this method is not finished yet, and relies on some images, on some specific locations. deprecated. use \*(C`for_tu\*(C'

RELATED TO XML::TMX::Reader…

XML::Writer\|(3), \s-1TMX\s0 Specification <http://www.lisa.org/tmx/tmx.htm>

AUTHOR

Alberto Simo\*~es, <[email protected]>

Paulo Jorge Jesus Silva, <[email protected]>

J.Joa\*~o Almeida, <[email protected]>

COPYRIGHT AND LICENSE

Copyright 2003-2012 by Projecto Natura

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.