AEM Classic Connector

Reusable Workflow Step

As of version 3.9.0, Smartling AEM Connector provides a common-purpose workflow step that can be embedded in your existing workflow. The primary goal is to simplify automation of translation processes inside the AEM.

Adding Smartling Workflow Step to Existing Workflow

In this example, we will use an OOTB Publish Example workflow. To add the Smartling step into the mentioned workflow:

  1. Open the workflow model for editing.
    publish_example.png
  2. Switch to a design mode, and allow it by using the Smartling - Workflow components group.
    publish_example2.png
  3. Return to an edit mode, and drag-and-drop the Send for Translation via Smartling step to the workflow model.
    publish_example3.png
  4. Save the workflow model.

Using Smartling Workflow Step

When executing as a part of a workflow, the Smartling step will send the payload page of the workflow, for translation. By default, the step tries to determine which translation directions are supported for the payload page. This is done by finding the best matching configuration profile.

If the appropriate configuration profile is found, the payload page is sent for translation to all the configured languages. Otherwise, an error is raised.

Customizing the Behavior of a Workflow Step

The default behavior described in the previous section can be customized. The following options are available:

  • Whether to translate only the current page or the page with all of its subpages (default - only the current page).
  • Whether to translation into all the configured languages or only specific ones (default - all the languages).

You should use AEM language codes, not Smartling language codes.

In order to override the defaults, the specific parameters should be passed to a workflow metadata.

Parameter Type Description
bulk Boolean Whether to translate only the current page or the page with all of its subpages (default: false - only the current page).
targetLocales String

Whether to translation into all configured languages or only specific ones. If not defined then use all configured languages.

Important: You should use AEM language codes, not Smartling language codes.

authorize Boolean Authorize job after attaching file(s). If not defined then the default: false.
translationJobUid String Attach uploaded file(s) to given translationJobUid. If not defined then create a new job with given jobName.
jobName String

Only used if translationJobUid is not defined (create a new job). If you create a new job but didn't provide a jobName then the job name will be generated by pattern: <date> - <path_to_page> - <timestamp>

Example:
2018-01-25 - /content/geometrixx/en/services/banking - 3046057842487

jobDescription String Set or update job description.
jobDueDate Calendar Set or update job due date. The new time must be in the future. 

Usage example:

Create a new job:

workItem.getWorkflowData().getMetaDataMap().put("bulk", false);
workItem.getWorkflowData().getMetaDataMap().put("targetLocales", new String[]{ "de", "fr" });
workItem.getWorkflowData().getMetaDataMap().put("authorize", true);
workItem.getWorkflowData().getMetaDataMap().put("jobName", "MyJobName");
workItem.getWorkflowData().getMetaDataMap().put("jobDescription", "MyJob description");

Date date = new Date();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 2);
workItem.getWorkflowData().getMetaDataMap().put("jobDueDate", cal);

Add to the existing job:

workItem.getWorkflowData().getMetaDataMap().put("bulk", false);
workItem.getWorkflowData().getMetaDataMap().put("targetLocales", new String[]{ "de", "fr" });
workItem.getWorkflowData().getMetaDataMap().put("authorize", true);
workItem.getWorkflowData().getMetaDataMap().put("translationJobUid", "aabbccdd");
workItem.getWorkflowData().getMetaDataMap().put("jobDescription", "MyJob description");

Date date = new Date();
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 2);
workItem.getWorkflowData().getMetaDataMap().put("jobDueDate", cal);

Was this article helpful?