CTSX Google Translator

Content management Incubator

Issues

Git

Git

Latest

3.4.15

Compatible with Magnolia 6.2.

The CTSX Google module performs translation via the Google Cloud Translation API. The Google Translation API supports more than one hundred different languages, from Afrikaans to Zulu. Used in combination, this enables translation between thousands of language pairs.

Installing with Maven

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

In order to start the Google translation process, please make sure that the core and apps modules in the Content Translation Extended have already been installed.
<dependency>
  <groupId>info.magnolia.translation</groupId>
  <artifactId>magnolia-content-translation-support-ext-google</artifactId>
  <version>3.4.15</version>
</dependency>
<dependency>
  <groupId>com.google.cloud</groupId>
  <artifactId>google-cloud-translate</artifactId>
  <version>2.22.0</version>
</dependency>

Configuration

Configuration of the Google service provider is handled in the module config. This provider can be configured with the following properties.

Please use JCR for module configuration. When using yaml, translation provider definition will not be loaded and connector will be not usable.

Property Description

autoTranslationAllowed

optional , default is false

When true the content review process (workflow) is bypassed.

class

required

Definition class for the translator to be used.

See info.magnolia.translation.ext.provider.google.definition.GoogleProviderDefinition.

clientId

required

Identifies the client application with Google.

clientToken

required

Client secret for the client ID.

configName

required

Identifies the configuration within Magnolia.

defaultFlag

optional

The default configuration used by the system in the case of multiple translation services being used.

implementationClass

required

Implementation class for interfacing with Google.

See info.magnolia.translation.ext.provider.google.translator.GoogleTranslator.

Sample configuration

'config':
  'jcr:primaryType': 'mgnl:content'
  'Google':
    'autoTranslationAllowed': 'false'
    'class': 'info.magnolia.translation.ext.provider.google.definition.GoogleProviderDefinition'
    'clientId': 'xxx'
    'clientToken': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
    'configName': 'Google.com'
    'defaultFlag': 'true'
    'enabledFlag': 'true'
    'implementationClass': 'info.magnolia.translation.ext.provider.google.translator.GoogleTranslator'

Usage

After registration and starting, The Content Translation Support Extended (CTSX) module will bind the Google translator to Configuration field.

You can test the connection to the translator api before using.

Choose Pages

  1. Choose the pages that contain the i18n items before starting the process.

    choose pages

  2. Click to 'Add to translation batch' action on action bar.

    add page to batch

  3. In the 'Add to translation batch' dialog:

    1. Input the batch name or select a existing batch.

    2. Check to include Dependencies and include Sub-nodes if necessary.

    3. Select Google.com in the Configuration.

    4. Optionally, add instructions and notes.

    5. Click Save Changes.

      translation batch dialog

Submit Batch

  1. Open the Translation Extend app (under the Tools menu).

  2. From the 'Batches' tab:

    1. Select your batch.

    2. Edit the batch information if you want.

    3. Click to 'Submit batch' action on action bar.

      submit batch

      After The executeGetTranslationCommand has run, you will get the Pulse notification for the translation result.
      You can bypass this step (auto import translated content) if you set "autoTranslationAllowed=true".
  3. In the 'Translation Review' dialog:

    1. Click to 'Assign to me' on action bar.

    2. Can be 'Approve & Import' or Reject the task.

    3. Click to 'Review' action for comparing the different.

      review the translated content

It can also be 'Import' or "Reject" in the 'Comparison' tab.

view diff comparison

Check the result

After importing the translated content, you can open the selected page again for checking the result.

check result page

Known issues

Too many text segments

In case of submitting many contents (such as the whole /travel page includes dependences), an error will be thrown as below. This is known issue as number of submitted segments is over google’s threshold.

ERROR info.magnolia.commands.MgnlCommand: Execution is error, update to translation task item {}
com.google.cloud.translate.TranslateException: Too many text segments
Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request {"code": 400, "errors" : [ { "domain" : "global", "message" : "Too many text segments", "reason" : "invalid" } ], "message" : "Too many text segments"}
Feedback

DX Core

×

Location

This widget lets you know where you are on the docs site.

You are currently perusing through the Content Translation Extended module docs.

Main doc sections

DX Core Headless PaaS Legacy Cloud Incubator modules