2021.2

Table Of Contents
6. Set the template's Locale, or select the field that contains a Locale value, in order to get
output in the correct language. See "Changing the locale" on page787.
Translating snippets
"Snippets" on page741 get translated when they are inserted in the output, if the text is tagged
for translation (see "Tagging text in snippets" on page940).
Translating content that is inserted by a script
Personalization scripts may add content to the output. OLConnect will apply translations to that
content at the moment it is added to the template, for example with the html() or replaceWith()
function. Translations are applied if that content is marked for translation, and if there is a
matching translation entry (see "Tagging text that is inserted by a script" on page940).
Translating content via a script
If a template has been prepared for translation, personalization scripts that add content to the
output may translate that content using the "translate()" on page1404 function.
Tagging elements for translation
In order to mark text for translation, you have to tag the HTML element that holds the text.
When you add elements, such as text, images or a table, to the content of a template, you are
actually constructing an HTML file. It is possible to edit the source of the HTML file directly in
the Designer; see "Editing HTML" on page635.
However, to tag an element for translation, you don't have to go into the Source view.
1. Place the cursor in the text that should be translated and select the HTML element in the
breadcrumbs (see "Selecting an element" on page638) or select the element via the
Outline view. Elements that contain text are paragraphs, headings, table cells, buttons,
labels etc.
2. Open the Translations pane. If it isn't visible, select: Window > Show View >
Translations from the menu.
3. Click the Tag Element button in the toolbar of the Translations pane. This adds the
data-translate attribute to the element. (Attributes are visible on the "Source tab" on
page1082.)
Page 938