The “Translate Content” sub-action allows content to be automatically translated from any language version to any other content language version that has been installed on the dotCMS server and configured on the “Translate Content” sub-action.
The steps below define how to set up auto-translation of content via a custom workflow. However, please be advised that the resulting translations will be imperfect, and should be reviewed and revised by content contributors that are proficient in each supported language.
Then add the “Translate Content” sub-action to the custom workflow as show below.
After choosing the “Translate Content” sub-action, double-click on the sub-action to configure the translation parameters.
Translate Subaction Parameters
The Translate Content sub-action has three parameters:
- Translate to: allows the “all” parameter to translate content for each installed language version on the dotCMS instance, or a comma separated list of each two letter language code can be added (Ex: es, fr, zh, etc.)
- Translate Field Types: Define field types that should be translated (Ex: text, wysiwyg, textarea, etc.)
- Ignore Fields: (optional) Provide a list of exception field types (by velocity variable name), that should NOT be translated. Velocity variable names for each field can be examined when editing the Content Type.
- Service API Key: (optional) The API key for your translation service can be placed here, or added to your dotCMS server configuration properties. If the configuration property has been set, the key will automatically display in the Service API Key field. However, if the configuration property has not been set, the Service API Key field will be empty, and must be set in the subaction parameters, otherwise the content will not be translated by the subaction.
Translation Service API Key Configuration
The translation service API key can be added to the dotmarketing-config.properties file, using a *configuration plugin. The key should be set on the following property:
*Be sure to use a configuration plugin with the property and key set in the dotmarketing-config-ext.properties file. See the Changing dotCMS Configuration Properties documentation for more information.
Using the Translate Subaction in a Workflow
After adding the custom workflow scheme to the Content Type properties, then your custom workflow button(s) should appear when editing content. Simply create the content in any single language, then click the custom workflow action that is tied to the “Translate Content” workflow sub-action. The content will be saved and the configured translations and content versions will be created.
The content search manager under the dotCMS Content tab has an advanced search option for displaying content by a specific language or “All” languages. In this example, the default English language version of the content has been translated, and two new language versions of the content have been created in Spanish and French.
In the image below, the “Description” text area shows the automated translation to Spanish by the custom sub-action.
For more information on sub-actions, see the Workflow Sub-actions documentation.