.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::TMX::Reader 3pm" .TH XML::TMX::Reader 3pm 2024-03-09 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME XML::TMX::Reader \- Perl extension for reading TMX files .SH VERSION .IX Header "VERSION" version 0.39 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& 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() .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module provides a simple way for reading TMX files. .SH METHODS .IX Header "METHODS" The following methods are available: .ie n .SS """new""" .el .SS \f(CWnew\fP .IX Subsection "new" 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 TMX header; .PP .Vb 1 \& my $reader = XML::TMX::Reader\->new("my.tmx"); .Ve .ie n .SS """ignore_markup""" .el .SS \f(CWignore_markup\fP .IX Subsection "ignore_markup" This method is used to set the flag to ignore (or not) markup inside translation unit segments. The default is to ignore those markup. .PP If called without parameters, it sets the flag to ignore the markup. If you don't want to do that, use .PP .Vb 1 \& $reader\->ignore_markup(0); .Ve .ie n .SS """languages""" .el .SS \f(CWlanguages\fP .IX Subsection "languages" 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. .ie n .SS """for_tu""" .el .SS \f(CWfor_tu\fP .IX Subsection "for_tu" Use \f(CW\*(C`for_tu\*(C'\fR to process all translation units from a TMX file. This version iterates for all tu (one at the time) .PP The configuration hash is a reference to a Perl hash. At the moment these are valid options: .ie n .IP """\-verbose""" 4 .el .IP \f(CW\-verbose\fR 4 .IX Item "-verbose" Set this option to a true value and a counter of the number of processed translation units will be printed to stderr. .ie n .IP """\-output"" | ""output""" 4 .el .IP "\f(CW\-output\fR | \f(CWoutput\fR" 4 .IX Item "-output | output" Filename to output the changed TMX 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. .ie n .IP """gen_tu""" 4 .el .IP \f(CWgen_tu\fR 4 .IX Item "gen_tu" Write at most \f(CW\*(C`gen_tu\*(C'\fR TUs .ie n .IP """proc_tu""" 4 .el .IP \f(CWproc_tu\fR 4 .IX Item "proc_tu" Process at most \f(CW\*(C`proc_tu\*(C'\fR TUs .ie n .IP """patt""" 4 .el .IP \f(CWpatt\fR 4 .IX Item "patt" Only process TU that match \f(CW\*(C`patt\*(C'\fR. .ie n .IP """\-raw""" 4 .el .IP \f(CW\-raw\fR 4 .IX Item "-raw" Pass the XML directly to the method instead of parsing it. .ie n .IP """\-verbatim""" 4 .el .IP \f(CW\-verbatim\fR 4 .IX Item "-verbatim" Use segment contents verbatim, without any normalization. .ie n .IP """\-prop""" 4 .el .IP \f(CW\-prop\fR 4 .IX Item "-prop" A hashref of properties to be \fBadded\fR to the TMX header block. .ie n .IP """\-note""" 4 .el .IP \f(CW\-note\fR 4 .IX Item "-note" An arrayref of notes to be \fBadded\fR to the TMX header block. .ie n .IP """\-header""" 4 .el .IP \f(CW\-header\fR 4 .IX Item "-header" A boolean value. If set to true, the heading tags (and closing tag) of the TMX file are written. Otherwise, only the translation unit tags are written. .PP The function will receive two arguments: .IP \(bu 4 a reference to a hash which maps: .Sp the language codes to the respective translation unit segment; .Sp a special key "\-prop" that maps property names to properties; .Sp a special key "\-note" that maps to a list of notes. .IP \(bu 4 a reference to a hash which contains the attributes for those translation unit tag; .PP If you want to process the TMX and return it again, your function should return an hash reference where keys are the languages, and values their respective translation. .ie n .SS """to_html""" .el .SS \f(CWto_html\fP .IX Subsection "to_html" Use this method to create a nice HTML file with the translation memories. Notice that this method is not finished yet, and relies on some images, on some specific locations. .ie n .SS """for_tu2""" .el .SS \f(CWfor_tu2\fP .IX Subsection "for_tu2" deprecated. use \f(CW\*(C`for_tu\*(C'\fR .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBXML::Writer\fR\|(3), TMX Specification .SH CONTRIBUTORS .IX Header "CONTRIBUTORS" Paulo Jorge Jesus Silva, .SH AUTHORS .IX Header "AUTHORS" .IP \(bu 4 Alberto Simões .IP \(bu 4 José João Almeida .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2010\-2017 by Projeto Natura . .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.