Class: MLTEngine

Help4.engine.MLTEngine(params)

MLTEngine class translates content on-the-fly

Constructor

new MLTEngine(params)

Parameters:
Name Type Description
params Help4.engine.MLTEngine.Params
Properties:
Name Type Description
controller Help4.controller.Controller
domRefreshEngine Help4.engine.DomRefreshEngine
_started boolean
_domRefreshExecutor function
_onPanelEvent function
_targetLanguage string
_sourceLanguages Array.<string>
_preferredLanguage string
_languageMap Object {en-US: ['de-DE', 'es-ES'], de-DE: ['en-US', 'es-ES'], ...}
_translationActive boolean
_openBubbles Array.<Help4.engine.MLTEngine.Bubbles>
_activeBubble Help4.engine.MLTEngine.Bubbles
_translatedBubble Help4.engine.MLTEngine.Bubbles
_excludeBubble string | null
_translationAvailable boolean
_cache Object {en: {id1: {translation: , original: }, id2: {}}, de: {id3: {...}, id4: {...}}}
_xhrPromiseContainer Object
_xhrError boolean
Source:

Extends

Members

TRANSLATION_STATES :Object

Type:
  • Object
Properties:
Name Type Description
success 'success'
fail 'fail'
partial 'partial'
skipped 'skipped'
Source:

Methods

(protected) ____defineDataFunctions()

Overrides:
Source:

(protected) ____defineProperties(params, derivedopt, nullable)

Parameters:
Name Type Attributes Default Description
params Object
derived Object <optional>
<nullable>
null
Properties
Name Type Description
GET Object
SET Object
Overrides:
Source:

(protected) ____defineProperty(args)

Parameters:
Name Type Description
args Object
Properties
Name Type Attributes Default Description
type string <optional>
'param' for Help4.jscore.DataBase
key string
info Help4.jscore.ControlBase.Param
funGet Help4.jscore.ControlBase.FunGet
funSet Help4.jscore.ControlBase.FunSet
Overrides:
Source:

(protected) ____defineStaticProperties()

auto define all to be cleaned properties
Overrides:
Source:
Throws:
Error

(protected) ____extendParams(dest, src) → {Object}

Parameters:
Name Type Description
dest Object
src Object
Overrides:
Source:
Returns:
Type
Object

(protected) ____getClassConfig() → {Help4.jscore.Base.Params}

Overrides:
Source:
Returns:
Type
Help4.jscore.Base.Params

(protected) ____getData() → {Object}

Overrides:
Source:
Returns:
Type
Object

(protected) ____mergeDerivedParams(level0, level1)

Parameters:
Name Type Description
level0 Help4.jscore.Base.Params
level1 Help4.jscore.Base.Params
Overrides:
Source:
Throws:
Error

(protected) ____resolveDerivedParams(classConfig)

Parameters:
Name Type Description
classConfig Help4.jscore.Base.Params
Overrides:
Source:

(protected) ____setInitValue(args)

Parameters:
Name Type Description
args Object
Properties
Name Type Description
key string
info Help4.jscore.ControlBase.Param
params Object
funSet Help4.jscore.ControlBase.FunSet
Overrides:
Source:

(protected) _destroyControl(…keys)

destroys class properties
Parameters:
Name Type Attributes Description
keys string <repeatable>
Overrides:
Source:

(protected) _fireEvent(event) → {Help4.jscore.Base}

fires an event that can be observed from outside
Parameters:
Name Type Description
event Object the event to be fired
Overrides:
Source:
Returns:
Type
Help4.jscore.Base

(async, protected) _fireEvent2(event) → {Promise.<Array.<Help4.EmbeddedEvent.EventResponse>>}

fires an event that can be observed from outside
Parameters:
Name Type Description
event Object the event to be fired
Overrides:
Source:
Returns:
Type
Promise.<Array.<Help4.EmbeddedEvent.EventResponse>>

(protected) _fireEventSync(event) → {Array.<Help4.EmbeddedEvent.EventResponse>}

fires an event that can be observed from outside
Parameters:
Name Type Description
event Object the event to be fired
Overrides:
Source:
Returns:
Type
Array.<Help4.EmbeddedEvent.EventResponse>

addListenerSync(eventType, listener) → {Help4.jscore.Base}

add an event listener
Parameters:
Name Type Description
eventType string | Array.<string> event type to be observed
listener Help4.EmbeddedEvent.Listener the callback function
Overrides:
Source:
Returns:
Type
Help4.jscore.Base

destroy()

destroys this instance
Overrides:
Source:

getPreferredLanguage() → {string}

Source:
Returns:
Type
string

getTargetLanguage() → {string}

Source:
Returns:
Type
string

isDestroyed() → {boolean}

whether instance is destroyed
Overrides:
Source:
Returns:
Type
boolean

isStarted() → {boolean}

Source:
Returns:
Type
boolean

isTranslationActive() → {boolean}

Source:
Returns:
Type
boolean

isTranslationAvailable() → {boolean}

Source:
Returns:
Type
boolean

(async) onBubbleClick(params) → {Promise.<void>}

Parameters:
Name Type Description
params Object
Properties
Name Type Description
bubble Help4.engine.MLTEngine.Bubbles
active boolean
Source:
Throws:
Error
Returns:
Type
Promise.<void>

(async) registerBubble(bubble)

Parameters:
Name Type Description
bubble Help4.engine.MLTEngine.Bubbles
Source:

(async) start() → {Promise.<void>}

Source:
Returns:
Type
Promise.<void>

(async) stop() → {Promise.<void>}

Source:
Returns:
Type
Promise.<void>

unregisterBubble(bubble)

Parameters:
Name Type Description
bubble Help4.engine.MLTEngine.Bubbles
Source:

Type Definitions

Bubbles

Type:
Source:

ContentObject

Type:
  • Object
Properties:
Name Type Description
data string
contentType string
language string
Source:

Params

Type:
Properties:
Name Type Description
controller Help4.controller.Controller
domRefreshEngine Help4.engine.DomRefreshEngine
Source:

PermissionsResponse

Type:
  • Object
Properties:
Name Type Description
response Object
Properties
Name Type Description
permission Object
Properties
Name Type Description
permissionNames Array.<string>
Source:

ServerResponse

Type:
  • Object
Properties:
Name Type Description
content Help4.engine.MLTEngine.ServerResponseContent
sourceLanguage string
targetLanguage string
Source:

ServerResponseContent

Type:
  • Object
Properties:
Name Type Description
contentType string content type of the text
data string translated text
encoding string
status number status code of the translation e.g. 200, 500 etc.
Source:

SupportedFeaturesResponse

Type:
  • Object
Properties:
Name Type Description
response Object
Properties
Name Type Description
feature Object
Properties
Name Type Description
featureNames Array.<string>
Source:

TranslationData

Type:
  • Object
Properties:
Name Type Description
data Object {en-US: Help4.engine.MLTEngine.ContentObject[], ...}
meta Object {en-US: [{original: , id: , widgetName: , subName?: }], de-DE: [{}]}
cache Object {en-US: [{translation: , original: , id: , widgetName: , subName?: }], de-DE: [{}]}
Source:

UrlConfig

Type:
  • Object
Properties:
Name Type Description
serverBaseUrl string base URL of the content server
translation string URL extension for translation calls
feature string URL extension to check if feature is supported in SEN
permission string URL extension to check if user has permission in SEN
supportedLanguages string URL extension to get supported languages
Source: