Skip to content

Translate ​

Last updated View as Markdown

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>

<!-- French -->
<span>Panier</span>

Arguments ​

ArgumentDescription
countSelects the plural form of the translation. See Pluralization.
any nameReplaces {{ name }} in the translation. See Interpolation.
liquid
{{ 'cart.items' | t: count: cart.item_count }}
{{ 'layout.header.hello_user' | t: name: customer.first_name }}