AEM Classic Connector

AEM Classic Connector Customize Translation Download and Cancellation Behavior

The following article lists custom properties for both translation download and translation cancellation.

Translation Download

Smartling AEM Connector fires an OSGI event when translation was downloaded. The primary goal is to provide convenient way for detecting the finish of the translation download. 

Custom properties

The event contains information about download. The list of next properties sets in an event when it is fired:

 

Parameter

Type 

Description

submission.configType

String

The type of configuration used for process the translation. It can be one of the next values: CONTENT, DIGITAL_ASSET, DICTIONARY, MEDIA_FILE, TAG

submission.created

Optional<Date>

The date when the submission was created

submission.fileUri

String

The file URI of file uploaded to Smartling

submission.jcrTitle

String

The title of the source item in AEM sending to translation

submission.lockedProperties

Set<String>

The set of properties for which translations will not be applied

submission.originalLocale

String

The locale of the source item sending to translation. Note: originalLocale is AEM language code, not Smartling language code

submission.targetLocale

String

The locale specify language to translating uploaded content. Note: targetLocale is AEM language code, not Smartling language code.

submission.progress

Double

The progress of translation. The used range [0-1], where 1 = 100%. An example progress 0.65 means 65%

submission.revision

String

The revision id of a source item when it was submitted for translation. Revision will be used when translations will be downloaded and applied. Connector will synchronize target item layout with revision of source item

submission.sourcePath

String

The path to source item sending to translation

submission.targetPath

String

The path where translations will be applied

submission.state

String

Can be one of the next values:

New, Changed, Failed, In translation, Completed, Canceled, Deleted

submission.submitted

Optional<Date>

The date when the source content was submitted to the Smartling

submission.updated

Optional<Date>

The date when the submission was updated last time

submission.submitterId

String

The id of user submitted the content to translation

submission.wordCount 

Integer

The total word count sending to translation

operation.status

String

has two values: SUCCESS; ERROR

operation.message

String

empty string if SUCCESS, and exception message if error

operation.forceDownload

Boolean

true\false. It's true when download was triggered by user or callback then 

 

Translation Cancellation

Smartling AEM Connector fires an OSGI event when user cancels translation from “Translation Progress”. The primary goal is to provide convenient way for detecting when the AEM Classic Connector deletes file from dashboard and stops to track translation progress for specific page + language. 

Custom properties

The event contains information about download. The list of next properties sets in an event when it is fired:

 

Parameter

Type 

Description

submission.configType

String

The type of configuration used for process the translation. It can be one of the next values: CONTENT, DIGITAL_ASSET, DICTIONARY, MEDIA_FILE, TAG

submission.created

Optional<Date>

The date when the submission was created

submission.fileUri

String

The file URI of file uploaded to Smartling

submission.jcrTitle

String

The title of the source item in AEM sending to translation

submission.lockedProperties

Set<String>

The set of properties for which translations will not be applied

submission.originalLocale

String

The locale of the source item sending to translation. Note: originalLocale is AEM language code, not Smartling language code

submission.targetLocale

String

The locale specify language to translating uploaded content. Note: targetLocale is AEM language code, not Smartling language code.

submission.progress

Double

The progress of translation. The used range [0-1], where 1 = 100%. An example progress 0.65 means 65%

submission.revision

String

The revision id of a source item when it was submitted for translation. Revision will be used when translations will be downloaded and applied. Connector will synchronize target item layout with revision of source item

submission.sourcePath

String

The path to source item sending to translation

submission.targetPath

String

The path where translations will be applied

submission.state

String

Can be one of the next values:

New, Changed, Failed, In translation, Completed, Canceled, Deleted

submission.submitted

Optional<Date>

The date when the source content was submitted to the Smartling

submission.updated

Optional<Date>

The date when the submission was updated last time

submission.submitterId

String

The id of user submitted the content to translation

submission.wordCount 

Integer

The total word count sending to translation

 

Handling the event

The listener should be implemented to handle this event. For example:

import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Properties;
import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Service;
import org.apache.sling.api.SlingConstants;
import org.osgi.service.event.Event;
import org.osgi.service.event.EventConstants;
import org.osgi.service.event.EventHandler;

@Component(
        // Event Listener starts listening immediately
        immediate = true
)
@Properties({
        @Property(
                label = "Event Topics",
                value = "com/smartling/classic/submission/CANCELLED",
                description = "[Required] Event Topics this event handler will to respond to.",
                name = EventConstants.EVENT_TOPIC,
                propertyPrivate = true
        )
})
@Service
public class TranslationCancelledEventHandler implements EventHandler {

  @Override

  public void handleEvent(final Event event) {

    log.info("Translation for page {} was canceled", event.getProperty("submission.targetPath");

  }

}

Was this article helpful?