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.
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.
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.
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.
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
Please check for updates, maybe now it will be possible to encode translations in a new way. Currently, I have a double task, I need to first translate malay to english and then code. This Malaysian shop that I am doing takes a lot of nerves and time. But I use some support resources and translation services that make this task much easier