The CTS T ranslations.com module extends the functionality of the CTS Workflow module to allow files to be sent to Translations.com for translation.

The module adds:

Please read the CTS Workflow module documentation before proceeding with this document.


Installing

This module:

Maven is the easiest way to install the module. Add the following dependency to your bundle:

<dependency>
  <groupId>info.magnolia</groupId>
  <artifactId>magnolia-module-content-translation-support-extend-ct-integration</artifactId>
  <version>2.0.0</version>
</dependency>

<dependency>
  <groupId>info.magnolia.campaign</groupId>
  <artifactId>magnolia-campaign-publisher</artifactId>
  <version>3.0.2</version>
</dependency>

Pre-built jars are also available for download. See Installing a module for help.

Configuration

The module is configured in /modules/content-translation-support-extend-ct-integration.

Node nameValue

 modules


 content-translation-support-extend-ct-integration


 commands


How Translations.com workflow works 

The module can be used in the three different ways detailed in this section. You can use different processes in different apps or any combination of these processes.

Single content items

This method describes the process of a reviewer sending a single content item to a translator who forwards the item to Translations.com.  

The CTS Demo module:

  • Enables single item Translations.com workflow in the Tour Categories app 
  • Adds two new groups in the Security app: reviewers and translatorssuperuser is assigned to the reviewers group and eric to the translators group. 

Here's how the Translations.com integration works for single content items:

  1. Reviewer (superuser):
    1. Selects an item for translation in the app
    2. Clicks Translate by workflow,
    3. Selects the target language(s) and adds a comment.
    4. Clicks Translate.
  2. Translators group:
    1. Is notified of the task in the Pulse (Task status: New).
    2. Translator (eric):
      1. Assigns himself the task (Task status: In Progress). Until this point the steps are the same as in the CTS Workflow module.
      2. Clicks Request translations.com to send the file to Translations.com for translation. 
      3. Receives a success message and the tasks state changes to Requested translations.com, waiting for response.
  3. Translator:
    1. Logs in to Translations.com's GlobalLink Project Director app.
      1. Selects the file and clicks Start Submission.
      2. You can login at your translations.com instance with your username and password to test.
  4. Magnolia monitors the progress of the translation using the Scheduler module. When the file has been translated it is uploaded automatically to Magnolia.
  5. Reviewers group:
    1. Is notified of the task in Pulse (Task status: New) on upload from Translations.com.
    2. Reviewer (superuser)
      1. Assigns himself the task.
      2. Has the following actions available: Approve & importReviewRejectAbort.
      3. Reviews the translated text and if satisfied imports it into the workspace.
          

Batch content items

Batch translation allows a reviewer (superuser) to send multiple content items to the translators group at the same time. The items are managed in the Translation Submit app.

The CTS Translations.com module enables batch content translation in the Pages app.

Except for step 1, the procedure is basically the same as for single content items

Here's how step 1 works for batch items:

Reviewer (superuser):

  1. In Pages:
    1. Selects multiple pages for translation. You can add pages from different sites and any location in the tree.
    2. Clicks Add to translation requests.
    3. Selects the batch, target language(s) and adds a comment.
    4. Clicks Save changes. This sends the items to the Translation Submit app.
  2. In the Translation Submit app:
    1. Reviews and manages the items. He can create new batches and folders, and delete items. 
    2. Clicks Submit batch to translations.com
    3. The Submit batch to translations.com action:
      1. Sends the items to the translators group in the Pulse.
      2. Changes the status of the items in the Translation Submit app to Exported
      3. From this point the procedure is the same as for single items.
    4. When the translator submits an item to Translations.com (from the Pulse), the translation status in the Translation Submit app changes to Sent.

You can add content items from different workspaces to the same batch by enabling batch translation in the underlying apps. For example you could add relevant tours, pages, contacts and tour categories to a campaign batch by adding the Add to translation requests action in the different apps..

Auto importing content

You can configure Magnolia to import translated content uploaded from Translations.com directly into the JCR. This bypasses the review process (step 5 above). See Enabling auto import for more.

Translations.com translator

The module includes a translator implementation that integrates Magnolia with Translations.com.

The translator is configured in the CTS Common module at /modules/content-translation-support-extend-common/config/translators.

Node nameValue

 content-translation-support-extend-common


 config


 translators


 TranslationsCom


 config


 class

info.magnolia.module.contenttranslationsupport.extend.ct.translator.TranslationsComConfig

 password

YourPasswordHere

 projectCode

YourProjectCodeHere

 submissionPrefix

magnolia-

 url

https://yourTranslations.comInstanceHere/instance

 userAgent

YourUserAgentHere

 username

YourUserNameHere

 class

info.magnolia.module.contenttranslationsupport.extend.ct.translator.TranslationsComTranslator

 default

true

 identifier

Translations.com

 name

Translations.com

Properties:

translators

required

Translators node in the CTS Common module.

TranslationsCom

required

Translator name.

config

required

Translator configuration node.

<properties>

required

Translations.com credentials.

  • class: TranslationsComConfig supports properties required to access Translations.com account.

class

required

Implements Translator for Translations.com.

default

required

Whether to use the default Translations.com settings.

identifier

required

Translator identifier.

name

required

Translator name.

Translations.com message views

The module adds the Request translations.com action to the translate message view configured in the CTS Workflow module

The action is configured in /modules/content-translation-support-extend-workflow/messageViews/translate/actions/translateByTranslator.

Node nameValue

 content-translation-support-extend-workflow


 messageViews


 translate


 actions


 translateByTranslator


 rules


 availability


  CanProceedTaskRule


  IsExportedRule


 writePermissionsRequired

true

 params


 translator

Translations.com

 catalog

ctIntegration

 class

info.magnolia.module.contenttranslationsupport.extend.workflow.action.MessageViewCommandActionDefinition

 command

requestTranslationCommand

 icon

icon-content-translation-app

 successMessage

Sent request to translations.com successfully, wating for response

 taskState

Requested translations.com, waiting for response

Properties:

actions

optional

Message view actions node.

availability

optional

Availability node.

rules

optional

Rules node.

<rule name>

required

Rule name.

  • CanProceedTaskRule defines availability when status is InProgress.
  • IsExportedRule defines availability when status is Exported.

writePermissionRequired

optional, default is false

Enables action for users with Read/Write permissions.

params

optional

Parameters node.

translator

optional

Translator name.

catalog

required

Translations.com command catalog.

class

required

MessageViewCommandActionDefinition extends CommandActionDefinition to support taskState property.

command

required

Command name.

icon

optional

Action icon.

successMessage

optional

Message displayed in the Pulse on successful execution.

taskState

optional

Task state displayed in the Pulse on successful execution.

The action is added to the action bar in /modules/content-translation-support-extend-workflow/messageViews/translate/actionbar/sections/workflowActions/groups/translationActions/items/translateByTranslator.

Translations.com commands

Three commands are registered in /modules/content-translation-support-extend-ct-integration/commands/ctIntegration.

Node nameValue

 commands


 ctIntegration


 receiveTranslatedContentCommand


 receiveContentCommand


 updateTaskStatusCommand


 class

info.magnolia.module.contenttranslationsupport.extend.workflow.command.UpdateWorkflowTaskStatusCommand

 decision

approve

 requestTranslationCommand


 translateCommand


 updateTaskStatusCommand


 executeByStatusCommand


 commands


 Sent


 expectedStatuses


 Sent

Sent

 catalogName

ctIntegration

 commandName

receiveTranslatedContentCommand

 jobRepeatCount

0

 Sent

0

 class

info.magnolia.module.contenttranslationsupport.extend.common.command.ExecuteByStatusCommand

Properties:

commands

optional

Commands folder.

ctIntegration

required

Translations.com integration catalog.

class

required

Command class (see table below).

<other properties>

required/optional

Properties supported by the command class.

Command classes:

Command nameClassOther properties

receiveTranslatedContentCommand



receiveContentCommand

info.magnolia.module.contenttranslationsupport.extend.ct.command. ReceiveTranslatedContentCommand

-

updateTaskStatusCommand

info.magnolia.module.contenttranslationsupport.extend.workflow.command. UpdateWorkflowTaskStatusCommand

decision=approve
requestTranslationCommand

translateCommand

info.magnolia.module.contenttranslationsupport.extend.common.command. TranslateCommand

-

updateTaskStatusCommand

info.magnolia.module.contenttranslationsupport.extend.workflow.command. UpdateWorkflowTaskStatusCommand

decision=approve

executeByStatusCommand

Used in scheduled job (see next section).

info.magnolia.module.contenttranslationsupport.extend.common.command. ExecuteByStatusCommand

Sent/expectedStatuses/Sent=Sent

catalogName=ctIntegration

commandName=receiveTranslatedContentCommand

jobRepeatCount=0

jobRepeatInterval=0

Receiving translated content from Translations.com

Magnolia uses the Scheduler module to receive translated content back from Translations.com. 

The scheduled job is configured in /modules/scheduler/config/jobs/checkAndExecuteTranslationCommands.

Node nameValue

 scheduler


 config


 jobs


 checkAndExecuteTranslationCommands


 catalog

ctIntegration

 command

executeByStatusCommand

 cron

 0/10 * * * * ?

 description

Get all translation statuses and execute commands every 10 seconds

 enabled

true

Properties:

jobs

required

Jobs node.

checkAndExecuteTranslationCommands

required

Name of the job.

catalog

required

ctIntegration catalog.

command

required

Command name.

executeByStatusCommand  is triggered when when the expectedStatuses of an item equals sent. The command calls the receiveTranslatedConentCommand which executes two chained commands: receiveConentCommand (uploads the content) and updateTaskStatusCommand (updates the task status).

cron

required

CRON expression that executes the job every 30 seconds.

description

optional

Description of the job

enabled

optional, default is false

Enables and disables the job.

Enabling Translations.com batch translation in content apps

You can enable Translations.com batch workflow in any content app.

Example: Enabling translations.com workflow in the Tours app

  1. Ensure that the fields you want to translate have an i18n property (set to true) in the detail subapp. See Enabling mulitlanguage content for more.
    Example: description text field in the tours tab in /modules/tours/apps/tours/subApps/detail/editor/form/tabs/tour/fields/description.

    Node nameValue

     editor


     form


     tabs


     tours


     fields


     name


     description


     class

    info.magnolia.ui.form.field.definition.TextFieldDefinition

     i18n

     true

     rows

    3
  2. Add the Add to translation requests (selectTranslationBatch) action to the browser supapp. 
    Example selectTranslationBatch  action in /modules/tours/apps/tours/subApps/browser/actions/selectTranslationBatch.

    Node nameValue

     browser


     actions


     selectTranslationBatch


     extends

    /modules/content-translation-support-extend-ct-integration/actions/selectBatchTranslationAction
  3. Add the action to the action bar. 
    Example selectTranslationBatch  action in /modules/tours/apps/tours/subApps/browser/actionbar/sections/item/groups/importExportActions/items/selectTranslationBatch.

    Node name

     browser

     actionbar

     sections

     item

     groups

     importExportActions

     items

     selectTranslationBatch

  4. Test the action in the app. 
    ExampleAdd to translation requests action and dialog in the Tours app.
       
#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))