Skip to content

Translate

Returns a string of translated text for a given translation key from a locale file.

Tip

To learn more about using the t filter, refer to storefront locale file usage or schema locale file usage.

Example

json
{
  "cart": {
    "page": {
      "title": "Shopping Cart"
    }
  }
}
json
{
  "cart": {
    "page": {
      "title": "عربة التسوق"
    }
  }
}
json
{
  "cart": {
    "page": {
      "title": "Panier"
    }
  }
}
liquid
<span>{{ "cart.page.title" | t }}</span>

The output is customized based on the settings in each locale file:

html
<!-- English -->
<span>Shopping Cart</span>

<!-- Arabic -->
<span>عربة التسوق</span>

<!-- Frenhc -->
<span>Panier</span>