Section translations

Dominik_Giroux
Shopify Partner
15 0 5

Hello, I'm very glad to see where Shopify is going with the new theme 2.0, however, something still bothers me.

Do we really have to manually add input fields in sections for each language we want to translate and hard code {% if request.locale.iso_code == "fr" %} again?

Everything else is translatable except sections inputs from users in the theme customizer. Am I missing something here?

If you have only two languages, it's maintainable, but if you want a true multilingual store, you would have to hard code a ton of elsif and it quickly becomes a mess.

Replies 10 (10)
sillycube
Shopify Partner
692 16 100

I guess you can use the section locale and t filter: https://shopify.dev/themes/architecture/sections/section-schema#locales

BYOB - Build Your Own Bundles, SPO - SEO App to research keywords & edit social link preview
Dominik_Giroux
Shopify Partner
15 0 5

Yep it seems that Shopify sneaked an update to section translations, I’ve been able to translate content since about two three weeks ago.

Meltin-Bit
Shopify Partner
14 0 5

Hi, but in this way the only thing that is translatable are labels, not content. Am I right?

I was looking for a way to translate all the dynamic content filled in the Customize sections. 

Did you manage a way to do it?

Thanks.

Fabio.

Meltin Bit
Dominik_Giroux
Shopify Partner
15 0 5
With the new OS 2.0 there was a sneaky updates and now sections and user input content are available for translation in any apps.
Meltin-Bit
Shopify Partner
14 0 5

Thanks for the quick reply, is there a documentation for that? I can't find anything.

Meltin Bit
Dominik_Giroux
Shopify Partner
15 0 5

Really depends what you are trying to do here, if you are developping an app for translations, I guess you could find something in the admin api documentation.

 

In your theme, you just have to insert a normal section settings and inputs and it will show up in translations app in the sections section with the block or section id as title I believe, that's how it work at least with Translation lab - AI translate on the free plan.

Meltin-Bit
Shopify Partner
14 0 5

Hi, I am trying to translate everything inside the Customize without leaving it. I am not building an App. 

I thought there were the possibility to manage the translations somehow without a third party app but It seems it is still not possible.

Meltin Bit
Dominik_Giroux
Shopify Partner
15 0 5

It would be possible to hardcode values in your theme that way.

Create a settings with an id of value_fr and another with value_en and in your code, check with

if request.locale.iso_code == "fr"

value_fr

else

value_en

endif

 

This is not a good solution however since the inputs are now translatable. I recommend to do this only for your own personnal store if you really don't want to use an app, even then, you could probably do something with metafields instead.

Meltin-Bit
Shopify Partner
14 0 5

Yes you're right It doable in that way but kind of static, i mean if in the future a language must be added all schema sections must be modified, not optimal 🙂 Do you know if the section schema is accessible from Api for some manipulation? It could be a way to add everything dynamically.

Meltin Bit
Geimsdin
Shopify Partner
1 0 1

Shopify and translations, seems to be back in the early 2000 coding world, incredible that they don't manage translations in a smart and adaptable way... it is all about buy apps... sad