XML::TMX::Writer(3pm)

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

✨ 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 are block, paragraph, sentence and phrase. Defaults to sentence.
  • 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 a srclang attribute 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 β€” undefined
  • alptext β€” WinJoust data
  • cdf β€” Channel Definition Format
  • cmx β€” Corel CMX Format
  • cpp β€” C and C++ style text
  • hptag β€” HP-Tag
  • html β€” HTML, DHTML, etc
  • interleaf β€” Interleaf documents
  • ipf β€” IPF/BookMaster
  • java β€” Java, source and property files
  • javascript β€” JavaScript, ECMAScript scripts
  • lisp β€” Lisp
  • mif β€” Framemaker MIF, MML, etc
  • opentag β€” OpenTag data
  • pascal β€” Pascal, Delphi style text
  • plaintext β€” Plain text (default)
  • pm β€” PageMaker
  • rtf β€” Rich Text Format
  • sgml β€” SGML
  • stf-f β€” S-Tagger for FrameMaker
  • stf-i β€” S-Tagger for Interleaf
  • transit β€” Transit data
  • vbscript β€” Visual Basic scripts
  • winres β€” Windows resources from RC, DLL, EXE
  • xml β€” XML
  • xptag β€” 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 in start_tmx method.
  • datatype β€” Same meaning as told in start_tmx method.
  • segtype β€” Same meaning as told in start_tmx method.
  • srclang β€” Same meaning as told in start_tmx method.

(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 🌟


πŸŽ€ CONTRIBUTORS πŸŽ€

Paulo Jorge Jesus Silva, <paulojjs@bragatel.pt> πŸ’–


πŸ‘‘ AUTHORS πŸ‘‘

  • Alberto SimΓ΅es <ambs@cpan.org>
  • JosΓ© JoΓ£o Almeida <jj@di.uminho.pt>

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