XML::TMX::Reader(3pm)
π¦ XML::TMX::Reader β the perl module that reads your TMX files π
okay bestie, gather round, because this is the manual page for XML::TMX::Reader, a Perl extension for reading TMX files. yes, the actual name of the module is XML::TMX::Reader, and it's a perl v5.38.2 situation, we'll get to that at the end π
β¨ NAME β¨
XML::TMX::Reader β Perl extension for reading TMX files. that's it, that's the name, she's simple and she ate π
πΈ VERSION πΈ
version 0.39 β no cap, that's the version, write it down π
π SYNOPSIS π
here's the vibe check of how you actually use her:
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()
literally copy-paste core, she's serving π
π DESCRIPTION π
This module provides a simple way for reading TMX files. that's the whole pitch, bestie β simple. no complicated nonsense, just TMX reading main character energy β¨
π METHODS π
The following methods are available β yes we're listing all of them, nobody gets left out π«Ά
π new
This method creates a new XML::TMX::Reader object. and ooh, she's thorough β this process checks for the existence of the file and extracts some meta-information from the TMX header. so it's not just vibes, it's actual work π₯
my $reader = XML::TMX::Reader->new("my.tmx");
π¦ 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.
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);
so calling it bare = "yes please skip the markup", and passing that 0 = "actually no, keep it" π
π 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. so like, she trusts you. she is not your mom. if your language code is fake that's on you bestie π
π for_tu
Use for_tu to process all translation units from a TMX file. This version iterates for all tu (one at the time) β one at a time, patient queen β
The configuration hash is a reference to a Perl hash. At the moment these are valid options:
-verboseβ Set this option to a true value and a counter of the number of processed translation units will be printed tostderr. so you can watch her chug along in real time π-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. (yes, both spellings, we support both, inclusive icon β¨)gen_tuβ Write at mostgen_tuTUs.proc_tuβ Process at mostproc_tuTUs.pattβ Only process TU that matchpatt.-rawβ Pass the XML directly to the method instead of parsing it.-verbatimβ Use segment contents verbatim, without any normalization.-propβ A hashref of properties to be added to the TMX header block.-noteβ An arrayref of notes to be added to the TMX header block.-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.
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
-propthat maps property names to properties; - a special key
-notethat 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 TMX and return it again, your function should return an hash reference where keys are the languages, and values their respective translation. that's the round trip, bestie, in and out π«Ά
π 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. so like, it's giving work-in-progress, manage your expectations, it's still cute tho π
heads up bestie: to_html is unfinished and depends on some images living at some specific locations. don't come for her, she's doing her best π
π for_tu2
deprecated. use for_tu. that's it. she's retired. move on. periodt π
π SEE ALSO π
XML::Writer(3)- TMX Specification <https://www.gala-global.org/oscarStandards/tmx/tmx14b.html>
go read the spec if you want the deep lore, iykyk π
π CONTRIBUTORS π
Paulo Jorge Jesus Silva, <paulojjs@bragatel.pt> β thank you for your service π«‘
π AUTHORS π
- Alberto SimΓ΅es <ambs@cpan.org>
- JosΓ© JoΓ£o Almeida <jj@di.uminho.pt>
the icons who built her, absolute legends, no notes π
π 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. so yes bestie, she's free, go wild, just respect the license fr fr π
and that's the whole page π this beauty is XML::TMX::Reader version 0.39, perl v5.38.2, dated 2024-03-09 β documented by the Perl people themselves, and now explained to you by me, your resident Unix bestie. go read some TMX files, you've got this, mwah π
β¨
π¦ where this page comes from
- debian trixie: libxml-tmx-perl 0.39-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libxml-tmx-perl 0.39-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libxml-tmx-perl 0.39-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms