Skip to main content

Defining Translations

Translations are defined in YAML format with 2-digit language codes (e.g., en, fr, es, de) as top-level keys. (Language Codes)
en:
  revenue: "Revenue"
  top_products: "Top Products"
  langcode: "en"
fr:
  revenue: "Chiffre d'affaires"
  top_products: "Meilleurs produits"
  langcode: "fr"
The yaml structure follows i18next conventions for each language.

Nested Translations

You can organize translations into groups:
en:
  metrics:
    revenue: "Revenue"
    customers: "Customers"
  categories:
    electronics: "Electronics"
    clothing: "Clothing"
fr:
  metrics:
    revenue: "Chiffre d'affaires"
    customers: "Clients"
  categories:
    electronics: "Électronique"
    clothing: "Vêtements"

Reusing Translations

Translations support i18next nesting syntax for reusing translations within other translations:
en:
  revenue: "Revenue"
  report_title: "Q4 $t(revenue) Report"
fr:
  revenue: "Chiffre d'affaires"
  report_title: "Rapport $t(revenue) T4"
When rendered, $translations.report_title becomes “Q4 Revenue Report” in English or “Rapport Chiffre d’affaires T4” in French.

Using Translations in Pages

Translations are accessible via the special $translations variable.
{% $translations.revenue %}

Inline in Text

# {% $translations.revenue %} Dashboard

In Component Attributes

{% big_value
  data="daily_orders"
  title=$translations.revenue
  value="sum(total_sales)"
  fmt="usd"
/%}

Templated in Strings

{% line_chart
  data="daily_orders"
  title="{{ $translations.revenue }} from {{ $translations.top_products }}"
  x="order_date"
  y="sum(total_sales)"
/%}

In SQL

```sql home_sales
select 
    label_{{ $translations.langcode }} as local_label
from description
```

Fallback Behavior

If a translation key is missing for the selected language, it will fall back to English (en) if available.