2022.2

Table Of Contents
Selector Matched ele-
ment
Matched element after script exe-
cution
p <p></p>
<p></p>
<p></p>
<p>0</p>
<p>1</p>
<p>2</p>
Usingeach()inatranslationscript
Thefollowingscriptfirstloadsasnippetcontainingtranslationstrings,dependingonthevalueofafield.
Thenitinsertstranslationsbyiteratingoverelementsintheresults(thesetofHTMLelementsthat
matchtheselectorofthescript)andsettingtheHTMLofeachelementwithavaluefromthearrayof
translationstrings.
var strings = loadjson('snippets/' + record.fields.locale + '.html');
results.each(function(index){
if( strings[this.attr('data-translate')])
this.html(strings[this.attr('data-translate')]);
});
Note: Fordocumentationonthedata-*attribute,seehttps://www.w3schools.com/tags/att_
global_data.asp.
Selector Matched ele-
ment
Matched element after script exe-
cution
p <pdata-trans-
late="first"></p>
<pdata-trans-
late="last"></p>
<pdata-trans-
late="email"></p>
<p>primero</p>
<p>último</p>
<p>direccióndecorreoelectrónico</p>
fatalError(message)
ThefatalError()functiontriggersafatalerrorthatabortscontentcreation.
message
Astring.
WhenascriptcallsthisfunctioninPreviewmode,thescriptthattriggersitismarkedwithanerroricon
intheScriptspane,andthegivenmessageisdisplayedinahint.
WhengeneratingoutputfromtheDesigner,theDesignerwilllogtheerroranddisplayanerrordialog
withthegivenmessage.Contentcreationisaborted.
Page 1173