de.folt.rpc.messages
Class TranslateDocument

java.lang.Object
  extended by de.folt.rpc.messages.TranslateDocument
All Implemented Interfaces:
RPCMessage

public class TranslateDocument
extends java.lang.Object
implements RPCMessage

Author:
Klemens Waldhör To change this generated comment edit the template variable "typecomment": Window>Preferences>Java>Templates. To enable and disable the creation of type comments go to Window>Preferences>Java>Code Generation.

Constructor Summary
TranslateDocument()
           
 
Method Summary
 java.util.Vector execute(java.util.Hashtable message)
          TranslateDocument translates a document using an OpenTMS data sources.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TranslateDocument

public TranslateDocument()
Method Detail

execute

public java.util.Vector execute(java.util.Hashtable message)
TranslateDocument translates a document using an OpenTMS data sources. Parameters are provided through a hash table. The hashtable contains the following keys:

openTMSTranslationPhase - the phase to apply - values can be CONVERT SEGMENT TMTRANSLATE TERMTRANSLATE BACKCONVERT TRANS BACK CONV SEG PT and their concatenation
sourceDocument - the document to translate
inputDocumentType - the type of the input document - either FILE if the document is supplied as a file or STRING if it is a string, MIME for MIME encoded string, ZIP for zpped files.
sklDocument - the name of the skelton file to be produced
xliffDocument - the name of the xliff file to be produced
segDocument - the name of the segmented xliff file to be produced
translatedDocument - the name of the translated xliff file
backConvertedDocument - the name of the back converted document
sourceDocumentLanguage - the source language
targetDocumentLanguage - the target language
sourceDocumentEncoding - the source encoding
targetDocumentEncoding - the target encoding
segmentBreakOnCrLf - for text file true if cr/lf constiture segment end
paragraphBasesSegmentation - true use paragraph based segmentation
dataTMXSourceName - the name of the TMX data source
dataTMXSourceType - the type of the data source; any defined database, e.g. MySQl
dataTMXSourceServer - the name of the server, e.g. localhost or IP address
dataTMXSourcePort - the port of the data source, e.g. 1433
dataTMXSourceUser - the user of the data source, e.g. sa
dataTMXSourcePassword - the name of the data source, e.g. folt
dataTMXSourceMatchQuality - the match quality in % as a umber between 0 and 100
dataTMXSourceMatchMaximum - number of maximum matchs to retrieve / -1 = all
dataTMXSourceReplacementClasses true if replacement classes shou,d be applied, otherwise false
dataTermSourceName - the name of the terminology data source
dataTermSourceType - the type of the data source; any defined database, e.g. MySQl
dataTermSourceServer - the name of the server, e.g. localhost or IP address
dataTermSourcePort - the port of the data source, e.g. 1433
dataTermSourceUser - the user of the data source, e.g. sa
dataTermSourcePassword - the name of the data source, e.g. folt
some Araya special setting
Araya_tmxfile - upon back conversion write the translations to this tmx file
Araya_useextensions - use filename extensions to determine document format (true/false)
Araya_donotresolveentities - for xml files - do not convert entities (true/false)
Araya_donotresolveentitiesfile - the name of the file containing entities which should not be resolved
Araya_useTranslateAttribute - use the translated attribute for matching (if attribute is no the segment is not translated) (true/false)

It returns:

vec.add("BACKSTRING"); - for a back converted file
vec.add(content); - the back converted file as a string MIME encoded - BASE64Encoder().encode
vec.add(dataSourceName + " successfully imported!");

or
vec.add("0");
vec.add("TRANSSTRING");
vec.add(content); - the transled file as a string MIME encoded - BASE64Encoder().encode
vec.add("SKLSTRING");
vec.add(content); - the skeleton string MIME encoded - BASE64Encoder().encode
or

vec.add(de.folt.constants.OpenTMSConstants.OpenTMS_ID_FAILURE +"");
vec.add(ex.getMessage());

Here is an example translation call:
call java -Xmx1024m %OPENTMSJAVABASE% de.folt.rpc.client.OpenTMSClient "message=TranslateDocument" "openTMSTranslationPhase=CONVERTSEGMENTTMTRANSLATETERMTRANSLATE" "sourceDocument=docs/Expose_TMOSS_12102007.odt" "sklDocument=docs/Expose_TMOSS_12102007.odt.skl" "xliffDocument=docs/Expose_TMOSS_12102007.odt.xlf" "segDocument=docs/Expose_TMOSS_12102007.odt.seg.xlf" "translatedDocument=docs/Expose_TMOSS_12102007.odt.trans.xlf" "paragraphBasesSegmentation=yes" "segmentBreakOnCrLf=1" "dataTMXSourceName=%OPENTMSTMX%" %EXAMPLEDBTMXSERVER% "dataTermSourceName=%OPENTMSTBX%" %EXAMPLEDBTBXSERVER% dataTMXSourceMatchQuality=80 dataTMXSourceMatchMaximum=10 sourceDocumentLanguage=de dataTMXSourceReplacementClasses=no targetDocumentLanguage=en sourceDocumentEncoding=UTF-8 targetDocumentEncoding=UTF-8 inputDocumentType=FILE
Here is an example back conversion call:
call java -Xmx1024m %OPENTMSJAVABASE% de.folt.rpc.client.OpenTMSClient "message=TranslateDocument" "openTMSTranslationPhase=BACKCONVERT" "sourceDocument=docs/Expose_TMOSS_12102007.odt.trans.xlf" "backConvertedDocument=docs/Expose_TMOSS_12102007.odt.trans.odt" sourceDocumentLanguage=de targetDocumentLanguage=en sourceDocumentEncoding=UTF-8 targetDocumentEncoding=UTF-8 inputDocumentType=FILE

Specified by:
execute in interface RPCMessage
Parameters:
message - a hash table containing the message specific parameters
Returns:
a Vector containing the results of executing the method.
See Also:
RPCMessage.execute(java.util.Hashtable)