Shopify themes, liquid, logos, and UX
I've used custom liquid in the product page to add input fields, I need to translate the labels for these input fields,
I tried this code but it gives me syntax error,
{% if request.locale.root_url == " en” %} {%- assign product_form_id = 'product-form-' | append: section.id -%} {% if product.metafields.custom.needsName.value %} <p class="line-item-property__field" style="font-size: 13px;"> <label for="{{ product_form_id }}-name">Type the Name. Maximum 5 characters</label> <br> <input form="{{ product_form_id }}" id="{{ product_form_id }}-name" type="text" name="properties[Name]" minlength="1" maxlength="5" style="width:100%; line-height: 40px; border:1px solid #333333;"> </p> {% endif %} {% if product.metafields.custom.needsDate.value %} <p class="line-item-property__field" style="font-size: 13px;"> <label for="{{ product_form_id }}-date">Type the Year. Exactly 4 numbers</label> <br> <input form="{{ product_form_id }}" id="{{ product_form_id }}-date" type="number" name="properties[Year]" min="1000" max="9999" style="width:100%; line-height: 40px; border:1px solid #333333;"> </p> {% endif %} {% endif %} {% if request.locale.root_url == "ar” %} {%- assign product_form_id = 'product-form-' | append: section.id -%} {% if product.metafields.custom.needsName.value %} <p class="line-item-property__field" style="font-size: 13px;"> <label for="{{ product_form_id }}-name">اكتب الإسم هنا. خمسة حروف كحد أقصى</label> <br> <input form="{{ product_form_id }}" id="{{ product_form_id }}-name" type="text" name="properties[Name]" minlength="1" maxlength="5" style="width:100%; line-height: 40px; border:1px solid #333333;"> </p> {% endif %} {% if product.metafields.custom.needsDate.value %} <p class="line-item-property__field" style="font-size: 13px;"> <label for="{{ product_form_id }}-date">اكتب السنة هنا. أربعة حروف كحد أقصى</label> <br> <input form="{{ product_form_id }}" id="{{ product_form_id }}-date" type="number" name="properties[Year]" min="1000" max="9999" style="width:100%; line-height: 40px; border:1px solid #333333;"> </p> {% endif %} {% endif %}
Solved! Go to the solution
This is an accepted solution.
Hi @Manager2020 ,
Please try replacing
{% if request.locale.root_url == " en” %}
with
{% if request.locale.iso_code == "en" %}
and
{% if request.locale.root_url == "ar” %}
with
{% if request.locale.iso_code == "ar" %}
This is an accepted solution.
Hi @Manager2020 ,
Please try replacing
{% if request.locale.root_url == " en” %}
with
{% if request.locale.iso_code == "en" %}
and
{% if request.locale.root_url == "ar” %}
with
{% if request.locale.iso_code == "ar" %}
Thank you very much,
The translation is working now! 🙂
Just one problem, the second field is not accepting any input now, neither numbers nor alphabets?
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025