XML::TMX::Writer(3pm)
β¨ XML::TMX::Writer β¨
okay so this is the manual page for XML::TMX::Writer, straight out of the User Contributed Perl Documentation, and bestie it is adorable β it's a whole little Perl module whose entire job is writing TMX files. That's it. That's the vibe. π
πΈ NAME πΈ
XML::TMX::Writer β a Perl extension for writing TMX files. no cap, that's the whole name section. short king. π
π VERSION π
version 0.39 β she's on 0.39 and she's thriving β¨
π¦ SYNOPSIS π¦
here's the whole thing in action, copy-paste ready, unchanged, iconic:
use XML::TMX::Writer;
my $tmx = XML::TMX::Writer->new();
$tmx->start_tmx(id => 'paulojjs');
$tmx->add_tu('en' => 'some text', 'pt' => 'algum texto');
$tmx->add_tu('en' => 'some text',
'pt' => 'algum texto',
-note => [32, 34 ],
-prop => { q => 23,
aut => "jj"}
);
$tmx->end_tmx();
look at her go. start, add, add, end. a full little journey ππ
π DESCRIPTION π
This module provides a simple way for writing TMX files. that's it! lowkey does what it says on the tin, and honestly? we love an honest module. π«Ά
β¨ METHODS β¨
The following methods are available β here's the lineup, diva by diva:
π new
$tmx = new XML::TMX::Writer();
Creates a new XML::TMX::Writer object. bam. brand new baby object, freshly created, main character energy from day one. π
π§ start_tmx
$tmx->start_tmx(-output => 'some_file.tmx');
Begins a TMX file. Several options are available, and bestie there are a lot of them, so buckle up:
-outputβ Output of the TMX. if you don't define one, stdout is used by default. (yes, she'll just talk out loud into your terminal, no shame.)toolβ Tool used to create the TMX. Defaults to'XML::TMX::Writer'.toolversionβ Some version identification of the tool used to create the TMX. Defaults to the current module version.segtypeβ Segment type used in the<tu>elements. Possible values areblock,paragraph,sentenceandphrase. Defaults tosentence.srctmfβ Specifies the format of the translation memory file from which the TMX document or segment thereof have been generated.adminlangβ Specifies the default language for the administrative and informative elements<note>and<prop>.srclangβ Specifies the language of the source text. If a<tu>element does not have asrclangattribute specified, it uses the one defined in the<header>element. Defaults to all.datatypeβ Specifies the type of data contained in the element. Depending on that type, you may apply different processes to the data.
The recommended values for the datatype attribute are as follow (this list is not exhaustive):
unknownβ undefinedalptextβ WinJoust datacdfβ Channel Definition Formatcmxβ Corel CMX Formatcppβ C and C++ style texthptagβ HP-Taghtmlβ HTML, DHTML, etcinterleafβ Interleaf documentsipfβ IPF/BookMasterjavaβ Java, source and property filesjavascriptβ JavaScript, ECMAScript scriptslispβ Lispmifβ Framemaker MIF, MML, etcopentagβ OpenTag datapascalβ Pascal, Delphi style textplaintextβ Plain text (default)pmβ PageMakerrtfβ Rich Text Formatsgmlβ SGMLstf-fβ S-Tagger for FrameMakerstf-iβ S-Tagger for Interleaftransitβ Transit datavbscriptβ Visual Basic scriptswinresβ Windows resources from RC, DLL, EXExmlβ XMLxptagβ Quark XPressTag
srcencodingβ All TMX documents are in Unicode. However, it is sometimes useful to know what code set was used to encode text that was converted to Unicode for purposes of interchange. This option specifies the original or preferred code set of the data of the element in case it is to be re-encoded in a non-Unicode code set. Defaults to none.idβ Specifies the identifier of the user who created the element. Defaults to none.-noteβ A reference to a list of notes to be added in the header.-propβ A reference to a hash of properties to be added in the header. Keys are used as the"type"attribute, value as the tag contents.
bestie pls note the naming is a lil chaotic β some options got a-in front (-output,-note,-prop) and some didn't (tool,id,srclangβ¦). that's just how she is. don't try to "fix" it, she's perfect. π
π add_tu
$tmx->add_tu(srclang => LANG1, LANG1 => 'text1', LANG2 => 'text2');
$tmx->add_tu(srclang => LANG1,
LANG1 => 'text1',
LANG2 => 'text2',
-note => ["value1", ## notes
"value2"],
-prop => { type1 => ["value1","value"], #multiple values
_ => 'value2', # anonymound properties
typen => ["valuen"],}
);
Adds a translation unit to the TMX file. Several optional labels can be specified:
idβ Specifies an identifier for the<tu>element. Its value is not defined by the standard (it could be unique or not, numeric or alphanumeric, etc.).srcencodingβ Same meaning as told instart_tmxmethod.datatypeβ Same meaning as told instart_tmxmethod.segtypeβ Same meaning as told instart_tmxmethod.srclangβ Same meaning as told instart_tmxmethod.
(she really said "same meaning as told in start_tmx" four times and honestly? efficient. we stan a cross-referencer. π«Ά)
π end_tmx
$tmx->end_tmx();
Ends the TMX file, closing file handles if necessary. the grand finale, the curtain call, the closing of the (file) handles ππ
π SEE ALSO π
- TMX Specification
https://www.gala-global.org/oscarStandards/tmx/tmx14b.html
π CONTRIBUTORS π
Paulo Jorge Jesus Silva, <paulojjs@bragatel.pt> π
π AUTHORS π
- Alberto SimΓ΅es
<ambs@cpan.org> - JosΓ© JoΓ£o Almeida
<jj@di.uminho.pt>
π 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. slay. free as in freedom, bestie, go wild. π β¨
and that's the whole page! this one shipped with perl v5.38.2 on 2024-03-09 β so yeah, she's been out here since way back and she still writes flawless TMX. periodt. π¦πΈ
π¦ 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