NAME
XML::TMX::Writer - Perl extension for writing TMX files
SYNOPSIS
use XML::TMX::Writer;
my $tmx = new XML::TMX::Writer();
$tmx->start_tmx(ID => 'paulojjs');
$tmx->add_tu(SRCLANG => 'en', 'en' => 'some text', 'pt' => 'algum texto');
$tmx->add_tu(SRCLANG => 'en',
'en' => 'some text',
'pt' => 'algum texto',
-note => [32, 34 ],
-prop => { q => 23,
aut => "jj"}
);
$tmx->end_tmx();
DESCRIPTION
This module provides a simple way for writing TMX files.
METHODS
The following methods are available:
new
$tmx = new XML::TMX::Writer();
Creates a new XML::TMX::Writer object
start_tmx
$tmx->start_tmx(OUTPUT => 'some_file.tmx');
Begins a TMX file. Several options are available:
- OUTPUT
-
Output of the TMX, if none is defined stdout is used by default.
- 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 =item 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.
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", ## properties
type2 => "value2",
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.
end_tmx
$tmx->end_tmx();
Ends the TMX file, closing file handles if necessary.
SEE ALSO
TMX Specification http://www.lisa.org/tmx/tmx.htm
AUTHOR
Paulo Jorge Jesus Silva, <paulojjs@bragatel.pt>
Alberto Simões, <albie@alfarrabio.di.uminho.pt>
COPYRIGHT AND LICENSE
Copyright 2003 by Projecto Natura
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 442:
Non-ASCII character seen before =encoding in 'Simões,'. Assuming CP1252