Magnolia 5.4 reached end of life on November 15, 2018. This branch is no longer supported, see End-of-life policy.
The Extend CTS Auto Translation Module allows you to automatically translate content using Google Translate or Microsoft Translator.
The module connects both external APIs with Magnolia enabling automatic machine-translation with a single click.
You can enable automatic translation in any content app. The CTS Demo module enables automatic translation in the Tour Categories app.
The module is configured in /modules/content-translation-support-extend-auto-translation
.
Node name |
---|
modules |
content-translation-support-extend-auto-translation |
dialogs |
commands |
The CTS Demo module enables automatic translation in the Tour Categories app.
To automatically translate content:
detail
subapp that you want to translate have an i18n
property set to true
. See Enabling multilanguage content for more.The module includes two default translator implementations that integrate external translation services:
Google
: Integrates with Google Translate API.Microsoft
: Integrates with Microsoft Translator Text API.Translators are configured in the CTS Common module in /modules/content-translation-support-extend-common/config/translators
.
Node name | Value |
---|---|
content-translation-support-extend-auto-translation-common | |
config | |
translators | |
config | |
clientCode | AIzaSyAsOSIL1-sEtF9gBB7eJEWlatS_HQdoTTc |
clientId | MagnoliaDemo1 |
class | info.magnolia.module.contenttranslationsupport.extend.autotranslation.translator.GoogleTranslator |
identifier | |
name | Google.com |
Microsoft | |
config | |
clientCode | lOSN0hgDEwpsjpd//RLv44UrmUIK+KZtEKesF2CxpTs= |
clientId | magnolia_module_cts_workflow_autotranslations |
class | info.magnolia.module.contenttranslationsupport.extend.autotranslation.translator.MicrosoftTranslator |
identifier | Microsoft |
name | Microsoft.com |
Properties:
<translator name> | required Name of translator. |
| required Configuration node. |
| required
|
| required
|
| required
|
| required Translator identifier. |
| required Translator name. |
The module registers one command: autoTranslateCommand
that chains four commands that are executed sequentially as a single command. The command is used for the commit
action in the Translation request dialog. The command classes are part of the CTS Common module.
The command is registered in /modules/content-translation-support-extend-auto-translation/commands/autoTranslation
.
Node name | Value |
---|---|
commands | |
autoTranslation | |
autoTranslateCommand | |
exportCommand | |
class | info.magnolia.module.contenttranslationsupport.extend.common.command.ExportTranslationCommand |
translateCommand | |
class | info.magnolia.module.contenttranslationsupport.extend.common.command.TranslateCommand |
trackingCommand | |
class | info.magnolia.module.contenttranslationsupport.extend.common.command.TranslationTrackingCommand |
importCommand | |
class | info.magnolia.module.contenttranslationsupport.extend.common.command.ImportTranslationCommand |
Properties:
commands | optional Commands folder |
| required Auto translation catalog. |
| required Main command name. |
| required Chained command node names. One for each command in the chain. The child commands are executed one-by-one in the node order from top down. |
| required
|
The Translation request dialog opens when the Automatic translate action is executed.
In addition to standard fields and actions, the dialog uses the custom auto translate command, translate dialog action definition class and languages select field.
The dialog is configured in /modules/content-translation-support-extend-auto-translation/dialogs/autoTranslationRequest
.
Node name | Value |
---|---|
dialogs | |
autoTranslationRequest | |
actions | |
commit | |
asynchronous | true |
catalog | autoTranslation |
class | info.magnolia.module.contenttranslationsupport.extend.common.action.TranslateDialogCommandActionDefinition |
command | autoTranslateCommand |
label | Translate |
cancel | |
form | |
tabs | |
translation | |
fields | |
repository | |
path | |
uuid | |
username | |
sourceLangDisplay | |
targetLangs | |
class | info.magnolia.module.contenttranslationsupport.extend.common.field.LanguagesSelectFieldDefinition |
label | Target languages |
leftColumnCaption | Configured languages |
required | true |
rightColumnCaption | Selected languages |
translator | |
comment | |
label | Translation request |
Properties:
autoTranslationRequest | required Dialog name. |
| required Actions node. |
| required
|
| required Form node. |
| required Tabs node. |
| required Translation tab. |
| required Fields node. |
| required
|
Here's the Translation request dialog.
You can enable automatic content translation in any content app.
Example: Enabling automatic translation in the Contacts app.
Add the i18n
property to any field you want to translate in the detail
subapp. See Enabling mulitlanguage content for more.
Example: New Bio text field in the Personal tab in /modules/contacts/apps/contacts/subapps/detail/editor/form/tabs/personal/fields/bio
.
Node name | Value |
---|---|
editor | |
form | |
tabs | |
personal | |
fields | |
bio | |
class | info.magnolia.ui.form.field.definition.TextFieldDefinition |
i18n | true |
label | Bio |
rows | 3 |
Add the Automatic translate action to the browser
supapp. The CTS Demo module adds the Automatic translate action to the Tour Categories app. You can copy the action configuration from there.
Example: automaticTranslateAction
in /modules/contacts/apps/contacts/subApps/browser/actions/automaticTranslateAction
.
Node name | Value |
---|---|
browser | |
actions | |
automaticTranslateAction | |
availability | |
nodes | true |
root | true |
class | info.magnolia.module.contenttranslationsupport.extend.common.action.OpenTranslateDialogActionDefinition |
dialogName | content-translation-support-extend-auto-translation:autoTranslationRequest |
icon | icon-content-translation-app |
label | Automatic translate |
Add the action to the action bar.
Example: automaticTranslateAction
in /modules/contacts/apps/contacts/subApps/browser/actionbar/sections/contact/groups/importExportActions/items/automaticTranslateAction
.
Node name |
---|
browser |
actionbar |
sections |
contacts |
groups |
importExportActions |
items |
export |
automaticTranslateAction |