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?
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025