Multilingual Content

In case you want to provide your content in multiple languages, it is important that once a user has selected a language, the selection persits across multiple pages. Automad provides an easy way to store such data in the session data array. The saved selection will then be used for all following requests to serve the corresponding content. Take a look at the multilingual content tutorial as a detailed example.

Saving the Language Selection

Assuming that the language selection is passed as a query string parameter with the name lang, it can be saved in the session data array like this:

<@ if @{ ?lang } @>
<@ set { %lang: @{ ?lang } } @>
<@ end @>

Now the language selection is saved in the %lang session variable and can be used in the current and in future requests.

Serving the Corresponding Content

In a second step, a simple conditional statement can be used to serve the corresponding content.