1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Magento 2: Validate error from review form on product page does not translate

Discussion in 'Programming/Internet' started by Raluca Albu, Aug 2, 2020.

  1. Raluca Albu

    Raluca Albu Guest

    The message 'Please select one of each of the ratings above.' is not translating, when you try to add a review without choosing the stars.

    The form is located in the file form.phtml

    vendor/magento/module-review/view/frontend/templates


    And the validation error is shown like this

    <input
    type="radio"
    name="ratings[<?php /* @escapeNotVerified */ echo $_rating->getId() ?>]"
    id="<?php echo $block->escapeHtml($_rating->getRatingCode()) ?>_<?php /* @escapeNotVerified */ echo $_option->getValue() ?>"
    value="<?php /* @escapeNotVerified */ echo $_option->getId() ?>"
    class="radio"
    data-validate="{required:true, messages:{required:'Please select one of each of the ratings above.'}}"
    aria-labelledby="<?php echo $block->escapeHtml($_rating->getRatingCode()) ?>_rating_label <?php echo $block->escapeHtml($_rating->getRatingCode()) ?>_<?php /* @escapeNotVerified */ echo $_option->getValue() ?>_label"
    />


    I tried to change it with

    data-validate="{required:true, messages:{required: <?php __('Please select one of each of the ratings above.') ?> }}"


    But it's not working.

    How can I translate this validation error?

    Login To add answer/comment
     

Share This Page