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?
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025