How do you access translations in app blocks / theme app extensions?

jeffquach
Shopify Partner
4 0 0

This link here mentions how to access translations for your app blocks but the example doesn't seem to work and seems to be for regular sections instead of app blocks:

 

https://shopify.dev/themes/architecture/sections/section-schema#locales

 

My locales section looks like the following:

 

 

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

 

 

I've tried a bunch of different permutations using the name of my section and the name of the file but nothing works.

 

Something tells me I'm doing something wrong or Shopify's documentation is lacking.

 

Any help on this would be much appreciated!

Reply 1 (1)

judgeme_lam
Shopify Partner
1 0 0

You can access defined `locales` in liquid template. Ex:

 

<div>{{ 'title' | t }}</div>

 

But I cannot find the way to use in `schema` (ex: "content": "t:title"). The section can be.

D.R.Y