Prevent variable from schema from being translated

Hi everyone,

In a section I added the possibility to add a custom class in the schema:

{
      "type": "text",
      "id": "custom_class",
      "label": "Customised class",
      "info": "Add a class to the section"
    }

And then I am using it like this in the HTML part:

<div class="{{ section.settings.custom_class }}">

The problem is that these classes are being translated! (and I don’t want to)

I am adding theses classes in french: “titre-bleu titre-souligne-palmier”
And in the english version of the website it becomes: “title-blue title-underline-palm”… ::

Do you know a way to prevent this?

Thanks in advance for any help.

Bruno

1 Like

Hi @Bruno_Ginoux, are you using Shopify’s built-in translation system (using locales/*.json files) or a third-party translation app (e.g. Langify, Weglot)?

Please refer the documentation:

https://help.shopify.com/en/manual/international/languages/translate

Hi, I’m using Translate & Adapt

I’ve read this, but it doesn’t help.

Translate & Adapt app automatically picks up most merchant-facing text fields for translation and there’s currently no schema attribute to mark a particular text field as untranslatable.

A straightforward solution is to revert the translation within the app’s interface, or manually update the locale files, so they align with the original language’s class names. However, this approach may not be very maintainable in the long run.

Have you tried to switch the field type to something less likely to be translated like html?

I just found out what you are talking about.
So yes I removed all the translations in english for the classes.
Too bad there is no way to mark a field as non-translatable…

Thank you.