1

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?

  • Make sure, there is an entry in your translation csv file for your text ''Please select one of each of the ratings above.' – MGento Nov 6 '17 at 10:42
  • It's there, but it doesn't translate. – Raluca Albu Nov 6 '17 at 12:13
0

This is currently a default Magento 2.2 bug.

It should be fixed in the next release (Magento v 2.2.2).

As a temporary solution you could try creating your own validation class as suggested here: https://github.com/magento/magento2/issues/10474

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.