Content translations

Below is how you can wrap a word, phrase or piece of content to enable translation when working on multi-lingual Sites and Templates.

<p>{% translate %}Hello World{% endtranslate %}</p>

In this case, the "Hello World" phrase is in the default language (normally english). When viewing a Site that has it's language set other than the default language, if a matching translation for the phrase if found it will display that. If no match is found, the default "Hello World" would be displayed.

Since the default text will display as a fallback, it does not hurt to add the `

` tags as needed, even if the translations are not ready yet.

Variable Translations

You can access directly a function if you want to translate a phrase that is coming from a variable.

{% set translate_string = "Hello World" %}
<p>{{ do_translate(translate_string) }}</p>

Last updated