Retrieves and prints text from the dictionary of the online store or the translation files of the theme.
Kuvaus
The tag prints the retrieved text entry in the language of the version the visitor is browsing.
The tag can be used to print text both from the online store's dictionary and the translation files of the theme. If a translation key is included in both the dictionary and the translation files, the dictionary takes precedence.
If the tag is used to print text from a translation file but there is no translation available in the language of the version, the text will be printed in the language of the default version or the first version that has the translation available.
There is a long and short syntax for the tag. With the short syntax, the only tag attribute you can use is escape
.
Näkyvyys
Toimii näkyvyydessä: globaali
Tags with global scope can be used on any template and in any tag.
Using the long syntax of the {Text} tag
{Text(
code: 'ContentLabel',
before: '<h1 class="ContentLabel">',
after: '</h1>'
)}
{Text(
code: 'CustomContent',
escape: false
)}
In this example, two entries are retrieved from the online store's dictionary with the ContentLabel
and CustomContent
keys.
Using the short syntax of the {Text} tag
When using the short syntax of the tag, set the key of the text to be retrieved as the name of the tag and insert a % sign ahead of it.
<h1>{\%CustomContent}</h1>
{%CustomContent}
The escape
attribute can be used in the short syntax by adding the \
character at the beginning of the markup. No other attributes are supported by the short syntax.
Attribuutit
The short syntax of the {Text}
tag only supports the escape
attribute.
If you need other attributes, use the long syntax of the tag.
code:
The unique key of a dictionary or translation file entry can be set in the admin panel or translation file.
Sallitut arvot: stringafter/before:
By using the
after
andbefore
attributes you can define content that is output either after or before the tag's output.Allowed values:HTML and Interface markup.
E.g.
before:
'<p>Tämä merkkaus näkyy ennen tagin omaa sisältöä.</p>'after:
'<p>Tämä taas näkyy tagin oman sisällön jälkeen.</p>'
If the tag does not produce any content, neither the content of the
after
andbefore
attributes will be output.escape:
Adds an escape character before quotation marks in the output.
The attribute makes it easier to process the tag-produced content when using JavaScript.
Allowed values:true/false. The default value is false.
or:
Defines alternative content that is displayed if the tag itself does not produce any content.
Allowed values:HTML and Interface markup.
E.g.
or:
'Sisältöä ei löytynyt.'