2021.2

Table Of Contents
Note that calling the translate() function may be unnecessary if a script adds text to an
element that has the data-translate attribute; see "Tagging text that is inserted by a script" on
page940. In that case, any existing translation will be applied automatically.
translate(message, context)
The translate() function gets the translation of a source text with an (optional) context. It
returns the message as-is if no translation is found.
message
String containing the message (the source text).
context
The message's context (optional). A context may be specified when creating a translation
entry. Specifying a context makes it possible to translate a certain text in different ways.
Example
The following line of code gets the translation of the string "Submit" that was registered with the
context "button".
var str = translate( "Submit", "button" );
Control Script API
The table below lists the objects that are the most important in Control Scripts. Click through to
the object to find a description and sample scripts.
See "Control Scripts" on page913 for information about this kind of scripts, how to insert them
and what you can do with them.
Other objects that are available to Control Scripts
The list below isn't exhaustive: most of the objects listed in the Designer API (see "Standard
Script API" on page1283) are also available in Control Scripts. Not all of those objects can be
used in Control Scripts, however. This is because Control Scripts differ from template scripts
(see "What Control Scripts are" on page913). For example, the query() function can't be used
in a Control Script because it requires access to the DOM which a Control Script doesn't have.
Page 1405