Question

Please any Ideas on how to translate the validation message on phone field on view/frontend/layout/checkout_index_index.xml:

<item name="telephone" xsi:type="array">
   <item name="validation" xsi:type="array">
      <item name="validate-phoneStrict" xsi:type="boolean">true</item>
   </item>
   <item name="config" xsi:type="array"> 
      <item name="tooltip" xsi:type="boolean">false</item>
   </item>
</item>

The validate-phoneStrict validator take the message in lib/web/prototype/validation.js line 528-530

['validate-phoneStrict', 'Please enter a valid phone number (Ex: 123-456-7890).', function(v) {....

Validation work well but, translation doesn't work....Please help me to have right process to translate validation message of this validation rule.

Thank you.

Was it helpful?

Solution

I have checked your query.

FYI :- If we use "validate-phoneStrict" validation for telephone it will show us error message like https://prnt.sc/10p00v3

So you can translate below message from your theme. Here is my theme path app/design/frontend/Megnor/mag110236_3/i18n/es_ES.csv.

"Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.","Por favor ingrese un número de teléfono válido. Por ejemplo (123) 456-7890 o 123-456-7890."

I have translated message for es_ES(Spaish) locale. You can change according to your need.

Please run static deploy command to see your changes effect on front end.

Please check and let me know if you have any query.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top