Skip to content

Developers · Pages and Layouts

Multi-Language Page

Last updated 7 November 2026

This document details the following aspects of a Multi-Language Page:

  • Defaults
  • Switching between languages
  • Simple usage
  • Arrays
  • Parameterisation (variables)
  • Pluralisation

Defaults

English is the default language.

If there is a query param in the URL, it will render the parameter's value. For example,  renders a page in German.

You can also set the language in  , and modify it with the param. Please visit the Context Variable documentation to learn more.

Switching between languages

You can check and set the language to switch using the following code:

{% liquid
  assign language_switch_url = context.location.pathname
  assign language_icon = "language-pl"
  if context.session.language == "pl"
    assign language_switch_url = language_switch_url | append: "?language=en"
    assign language_icon = "language-en"
  else
    assign language_switch_url = language_switch_url | append: "?language=pl"
  endif
%}
<a href="{{ language_switch_url }}" aria-label="Change language">
  {%- include "svg/icons", icon: language_icon -%}
</a>

Simple usage

To use the feature, at least one translation file must be present.

We will use the page translation key in two languages in this example to demonstrate the mechanism.

---
slug: multilanguage
---
{{ "general.greeting" | t }}

app/translations/en.yml

en:
  general:
    greeting: Hello, World!

app/translations/pl.yml

pl:
  general:
    greeting: Witaj świecie!

Having these two files enables you to use the filter. stands for , and you can use both methods to implement the filter. Please visit our documentation on Insites Liquid Filters for more information.

For example, opening will default to English. Opening will try to use Polish and fall back to English for keys that have yet to be found.

/multilanguage

Hello, World!

/multilanguage?language=pl

Witaj świecie!

Arrays

Inside YAML, it is possible to include any data structure that is usable in JSON, including arrays.

Visit json2yaml to learn how YAML will convert to JSON or vice-versa if you feel more comfortable in JSON.

You can use this feature alongside other filters to store collections in a readable form.

app/translations/en.yml

en:
  general:
    cars:
      - Ford Mustang
      - Corvette
      - Gran Torino

app/translations/jp.yml

jp:
  general:
    cars:
      - Honda
      - Subaru
      - Lexus

Example page

{% assign cars = "general.cars" | t | to_hash %}

<ul>
{% for car in cars %}
<li>{{ car }}</li>
{% endfor %}
</ul>

/multilanguage?language=en

<ul>
  <li>Ford Mustang</li>
  <li>Corvette</li>
  <li>Gran Torino</li>
</ul>

/multilanguage?language=jp

<ul>
  <li>Honda</li>
  <li>Subaru</li>
  <li>Lexus</li>
</ul>

Parameterisation (variables)

Sometimes you'll need to translate parts of a sentence but keep others (e.g. names). In these cases, some of the content should be parameterised.

The filter accepts named arguments, and the syntax is available in translation keys.

app/translations/en.yml

en:
  personal:
    hello: "Hello %{name}. Take a look at my website: %{url}"

app/translations/pl.yml

pl:
  personal:
    hello: "Cześć %{name}. Zerknij na moją stronę www: %{url}"

Example page

{% liquid
  assign my_name = context.params.name | default: "Pawel"
  assign url = context.params.url | default: "https://example.com"
%}

{{ "personal.hello" | t: name: my_name, url: url }}

/multilanguage?language=en&name=John&url=https://docs.growthgardens.com

Hello John. Take a look at my website: https://docs.growthgardens.com

/multilanguage?language=pl&name=Pawel&url=https://growthgardens.io

Czesc Pawel. Zerknij na moja strone www: https://growthgardens.io

Pluralisation

In many languages — including English — there are only two forms: singular and plural for a given string, e.g. "1 message" and "2 messages". Other languages (Arabic, Japanese, Russian and many more) have different grammar with additional or fewer plural forms. Thus, the provides a flexible pluralisation feature.

The interpolation variable has a unique role in that it is interpolated to the translation and picks a plural form from the translations according to the pluralisation rules defined in the backend. By default, only the English pluralisation rules are applied.

If you set this to your language file:

about_x_item:
  one: "One item"
  other: "%{count} items"

Then:

{{ "about_x_item" | t: count: 12 }}
{{ "about_x_item" | t: count: 1 }}

The output rendered is:

12 items
One item