How can I translate my custom liquid section into Italian?

Hello!!

My website is in english and I need to translate it on italian.

Through Translate & Adapt (Shopify’s app) I’ve create “it.json” file, like image below.

I’d like to know if is possible to translate the custom liquid section in this file and also how can I do it?

Can you show me one example??

Thank you so much!!

Hey @Niccolo8 !

Yes, it is possible to translate custom liquid sections using the “it.json” file generated by Shopify’s Translate & Adapt app.

Here is an example of how to translate a custom section in liquid using the “it.json” file:


{% assign my_section_translations = translations.sections.my_section %}

<div class="my-section">
  <h1>{{ my_section_translations.header }}</h1>
  <p>{{ my_section_translations.description }}</p>
</div>

In this example, translations is a global object that contains all the translations from the “it.json” file. The sections property contains translations for custom sections, and the my_section property contains translations for the specific custom section.

You can use my_section_translations.header and my_section_translations.description to retrieve the translated header and description for the section, respectively.

Please also make sure that you should add the same section name which is being used in the “it.json” file to access the translated text.

Please be aware that any custom section file that you want to translate should be in your theme’s sections directory, and the files should be using the .liquid extension.

Also, after you’ve made these changes and added the translations to the “it.json” file, you should be able to switch the language of your store and see the translations displayed on your website.

Hope this helps!

1 Like

Thank you so much @Moira

@Niccolo8 My pleasure! Don’t hesitate to reach back out if you require any further assistance as you continue to work on your store.

All the best,