Translating custom liquid code

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 %}

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! :slightly_smiling_face:

Just one problem, the second field is not accepting any input now, neither numbers nor alphabets?