2022.2

Table Of Contents
Notethatcallingthetranslate()functionmaybeunnecessaryifascriptaddstexttoanelement
thathasthedata-translateattribute;see"Taggingtextthatisinsertedbyascript"onpage419.In
thatcase,anyexistingtranslationwillbeappliedautomatically.
translate(message, context)
Thetranslate()functiongetsthetranslationofasourcetextwithan(optional)context.Itreturns
themessageas-isifnotranslationisfound.
message
Stringcontainingthemessage(thesourcetext).
context
Themessage'scontext(optional).Acontextmaybespecifiedwhencreatingatranslationentry.Spe-
cifyingacontextmakesitpossibletotranslateacertaintextindifferentways.
Example
Thefollowinglineofcodegetsthetranslationofthestring"Submit"thatwasregisteredwiththecontext
"button".
var str = translate( "Submit", "button" );
Control Script API
ThetablebelowliststheobjectsthatarethemostimportantinControlScripts.Clickthroughtothe
objecttofindadescriptionandsamplescripts.
See"ControlScripts"onpage398forinformationaboutthiskindofscripts,howtoinsertthemand
whatyoucandowiththem.
Other objects that are available to Control Scripts
Thelistbelowisn'texhaustive:mostoftheobjectslistedintheDesignerAPI(see"StandardScriptAPI"
onpage715)arealsoavailableinControlScripts.NotallofthoseobjectscanbeusedinControl
Scripts,however.ThisisbecauseControlScriptsdifferfromtemplatescripts(see"WhatControl
Scriptsare"onpage398).Forexample,thequery()functioncan'tbeusedinaControlScript
becauseitrequiresaccesstotheDOMwhichaControlScriptdoesn'thave.
Object Usage
channel(see
"Channel"on
page837)
Thechannelforwhichoutputisgenerated.Thisisregisteredinthemergeobject:merge.channel.Notethatthechanneldoesn't
changewhentheoutputconsistsofdifferentcontexts.Whengeneratingemail,forexample,thechannelisEMAIL,evenwhenmer-
gingthePrintcontexttoattachittotheemail.
Page 814