Using locale translations for section settings in Shopify

I’m working with Shopify sections and I’m trying to implement locale languages based on their documentation. The example provided in the docs is:

"locales": {
    "en": {
        "title": "Slideshow"
    },
    "fr": {
        "title": "Diaporama"
    }
}

Using this structure, I can output the localized title in the same section with: {{ ‘sections.slideshow.title’ | t }}. But, I’m facing a challenge when trying to utilize this in section’s schema setting, for example:

{
    "type": "header",
    "content": "t:sections.slideshow.title"
}

It throws an error: missing translation. Even {{ ‘sections.eg-logo-carousel.direction’ | t }} just outputs the same string as-is.

Has anyone encountered this and found a solution?

Hi there!

You should have a file called en.default.schema.json (assuming English is set up as your default language) in your Locales folder. In this you’ll find the translations that can be used in your sections schema. For example, if you are using the Dawn theme and want to output the word ‘Slideshow’, you would use “t:sections.slideshow.name”.

Here’s a link to the Shopify docs on Locales that you might find helpful - https://shopify.dev/docs/themes/architecture/locales