1. Introduction

Events are an easy way to extend TranslationStudio and respond to specific events during the working process.

The following events are available out of the box

Full qualified class path Description

com.idmedia.translationstudio.events.AvoidCustomMessageFileEvent

Do not create an additional text file.

com.idmedia.translationstudio.events.GroupExportedXmlsByRequestEvent

If a translatable XML package is created, XMLs will be assigned to a job based on the actual translation request (i.e. what was sent at the same time)

com.idmedia.translationstudio.events.OnReceivedXmlFromCMSEvent

Removes multiple spaces from translatable XML’s text nodes if necessary. This event does not evaluate the content further, it simply applies the regular expression {2,}

com.idmedia.translationstudio.events.PlainCustomMessageEvent

Since the (optional) default message file associated to an XML file has some meta information, this event strips these and only provides the plain text message as given by the editors.

com.idmedia.translationstudio.events.RemoveXMlFieldsEvent

This event allows to hide certain plain text fields from the translatable XML file. A more detailed description is given below.

com.idmedia.translationstudio.events.SummarizeAdditionalTextsEvent

This event allows to create a summary description of all additional texts when creating a TMS project. This event may be combined with com.idmedia.translationstudio.events.AvoidCustomMessageFileEvent

At the moment, you cannot chain events of the same type.

1.1. Activation

You can activate events by opening your TranslationStudio configuration interface, navigating to Plugins and adding the respective event(s) to the Connector Events field. The events are available immediately after having saved the configuration.

2. Avoiding additional text files

By default, TranslationStudio stores the user’s additional information (text, due date etc.) in a separate text file for each XML (if necessary). If you do not want this to happen, this is the event to use.

3. Creating a custom TMS project summary

You can create a description that can be used when creating a translation project in your TMS of choice. Thereby, you can avoid additional text files if need be.

Besides adding this event to the event list in your configuration panel, you need to deploy a text file to TranslationStudio and save it to

./conf/tpl.project-description.txt

3.1. Example

Let’s assume a scenario, in which you would like to create project descrption which tells the translators who to contact and also add a custom message with additional information.

Therefore, you would need to add 2 custom input fields to your translation workflow form.

<CMS_INPUT_TEXT useLanguages="no" name="sc_message">
  <LANGINFOS>
    <LANGINFO lang="*" label="Message to the translators" />
  </LANGINFOS>
</CMS_INPUT_TEXT>

<CMS_INPUT_RADIOBUTTON gridWidth="1" name="sc_contact" useLanguages="no" allowEmpty="no">
  <ENTRIES>
    <ENTRY value="John Doe">
      <LANGINFOS>
        <LANGINFO lang="*" label="John Doe"/>
      </LANGINFOS>
    </ENTRY>
    <ENTRY value="Jane Doe">
      <LANGINFOS>
        <LANGINFO lang="*" label="Jane Doe"/>
      </LANGINFOS>
    </ENTRY>
  </ENTRIES>
  <LANGINFOS>
    <LANGINFO lang="*" label="Contact person" />
  </LANGINFOS>
</CMS_INPUT_RADIOBUTTON>

To process these information, the tpl.project-description.txt could look like this.

Dear translator,
please contact {sc_contact} if you have any questions.

Additional information: {sc_message}

The input text field’s name can be used in the text template file by wrapping it in curly brackets.

4. Hiding XML fields

Sometimes, you do not want certain text fields to be visible to the translator. These may contain meta information or additional non-translatable information. By default, TranslationStudio does not identify such fields. Therefore, this event allows you to take care of this.

Besides adding this event to the event list in your configuration panel, you need to deploy a text file to TranslationStudio and save it to

./conf/hidefields.txt

The format is simple and each field to be hidden has to added in a separate line, e.g.

pt_somefield
pt_text

This event will convert the source XML nodes such as

<CMS_VALUE name="pt_text">
    <TEXT>My text to hide</TEXT>
</CMS_VALUE>

into

<CMS_VALUE name="pt_text" ts-text-hidden="My text to hide">
    <TEXT/>
</CMS_VALUE>

Upon import, the same event will make sure the hidden fields are added to the XML again.

5. List of events to implement your own events