Use Multiple Languages (SG:lang tag)
When you use a Content Block in a message, the content is generally non-editable. The only exceptions are:
- SG tags
- Editable links
You can modify these elements after adding the Content Block to a message.
By using the SG:lang tag, you can make the content of a non-editable Content Block language dependent.
Make content language-dependent
Use the following syntax to define language-specific content:
<sg:lang value="EN">…</sg:lang>
<sg:lang value="NL" >…</sg:lang>
Each <sg:lang> tag contains the content that should display for a specific language.
Example of a Content Block with SG:lang tag:
<sg:content id="content-1">
<sg:lang value="NL">Nederlandse content</sg:lang>
<sg:lang value="EN">English content</sg:lang>
</sg:content>
The value attribute must match the language code of the message in which the Content Block is used.
Important usage rules
-
SG:lang tags can contain HTML only. You cannot nest other SG tags inside an SG:lang tag.
-
Make sure the language codes used in SG:lang tags match the language codes configured in your system. Contact your system administrator to confirm the correct codes.
-
If a message uses a language code that is not included in the Content Block, no content is rendered.
Use SG:lang Inside Other SG Tags
You can also use language tags inside other SG tags. This allows you to define language-specific attributes.
When multiple attributes exist:
-
Language-specific attributes take priority over generic attribute values.
-
Only the attributes that match the user’s language are rendered.
Supported language-dependent attributes
You can define the following attributes per language:
-
Images
- src
- href
- alt
-
Buttons
- href
- text
Examples: language-specific attributes
Example for an image:
<sg:image id="my_img" style="width:100px">
<sg:lang value="nl" alt="De zon" />
<sg:lang value="fr" alt="Le Soleil" />
</sg:image>
In this example, the alt text changes based on the language of the message.
Example for content:
<sg:content id="content-1">
<sg:lang value="NL">Nederlandse content</sg:lang>
<sg:lang value="EN">English content</sg:lang>
</sg:content>
Where value is the language code that needs to correspond to the language of the message in which the Content Block is used.
More information on the use of Content Blocks with multiple languages can be found in this topic.