Shopify text translation

Viewed 27

My website is made by shopify and I use the dawn theme. I've been trying for a few days to translate the word "Color" from inside the product pages into my language "Culoare". I looked for a solution on the internet, but I didn't find it. I don't want to translate the whole website because it is translated, I'm interested in translating only the variant picker metafield, the "Color" and "Size" options.

Thank you in advance.

1 Answers

You can put this code inside your main-product.liquid so that you can use the t filter for translation:

{% if option.name == 'Colors' %}
    {% assign color_label = 'products.product.colors' %}
    <legend class="form__label">{{ color_label | t }}</legend>
{% else %}}
    <legend class="form__label">{{ option.name }}</legend>
{% endif %}

Then in your ro-RO.json add the reference to the translation:

"products": {
  "product": {
    "add_to_cart": "Adăugați în coș",
    "colors": "Culoare"
  }
}

It's the solution I came up with. Maybe there is a better solution.

Related