Skip to main content

translate

string | t
returns string

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

The translate filter has an alias of t, which is more commonly used.


Tip

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


Anchor to Section locales vs. theme locales

Section locales vs. theme locales

The t filter can also reference keys defined in the locales object of section file's schema tag. Content that you put in the schema under the locales object is only accessible to that section. This is useful if you need to make a standalone section that you want to share between themes.

Content that is global to a theme should be placed in the theme's locales directory. For example, you could include the expression "See more" in your locales directory to create a single translation. You could then use the translation in a blog post and on the product details page.


Note

Translations in the section's schema tag that aren't part of the locales object are used for merchant-facing text shown in the theme editor. These translations don't use the t filter.


Was this page helpful?