How can I dynamically display store languages in section schema?

Here I have to display store languages by fetching through each loop and display it over here in

{% schema %} {% endschema %}

section

{
"type": "checkbox",
"id": "enabled_en",
"default": true,
"label": "Show in English Language"
},
{
"type": "checkbox",
"id": "enabled_fr",
"default": true,
"label": "Show in French Language"
},

So I have to make “Show in English Language”,“Show in French Language” text make it dynamic using this liquid code

{% for language in localization.available_languages %}

 object['{{ language.iso_code }}'] = "{{ language.name }}"

{% endfor %}

How we can do this ?? can anyone please suggest me

Also shopify provide setting schema type like textbox, text area, checkbox, product and collection etc (https://shopify.dev/docs/themes/architecture/settings)) but shopify not provide any type for the country and language. Does anyone know is there any type available for that?

To make “Show in English Language” and “Show in French Language” dynamic using the provided liquid code, you can modify your schema code like this:

{% schema %} { "type": "checkbox", "id": "enabled_en", "default": true, "label": "Show in {{ object['en'] }}" }, { "type": "checkbox", "id": "enabled_fr", "default": true, "label": "Show in {{ object['fr'] }}" } {% endschema %}

 

In this code, we have used the object variable that you have defined in your liquid code to fetch the language names dynamically. The {{ object['en'] }} will fetch the name of the language with the ISO code “en” and {{ object['fr'] }} will fetch the name of the language with the ISO code “fr”.

Regarding your second question, Shopify does not provide a built-in type for selecting languages or countries in the settings schema. You can use a text field or a dropdown to allow the user to enter/select the language or country. However, you can use a third-party app or a custom solution to provide a better user experience for selecting languages and countries.

Hello Mics,

Your solution is good but this is not as per my requirement because my question is different. Suppose in my store I have English, Spanish, French and Germany Language. So How we can make text " “Show in English Language” and “Show in French Language” dynamic using for loop.
{% for language in localization.available_languages %}
{{ language.iso_code }}

{% endfor %}

This above dynamic code I have to integrate in our setting {% schema %} {% endschema %}

please dm with details and Store URL i’ll have a look

Did you ever get a solution to this question? We have a series of metaobjects that we add as time goes on. I would like to add a schema control in a section that would find all the metafields of that type and give our template builders a checkbox to select which metafield to use on the page they’re adding. We have a number of different product templates that share SOME characteristics but not all (would be nice to have an inheritance structure for templates, but I digress!) and it is a pain to have to go and modify each one every time something new is added. This seems very similar to your issue.