XML::TMX::Reader(3pm)

πŸ“¦
version 0.39 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ¦‹ 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 to stderr. 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 most gen_tu TUs.
  • proc_tu β€” Process at most proc_tu TUs.
  • patt β€” Only process TU that match patt.
  • -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 -prop that maps property names to properties;
    • a special key -note 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 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 🌟

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 πŸ’–


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