Skip to content

Commit

Permalink
Merge forwardport of #11069 to 2.3-develop branch
Browse files Browse the repository at this point in the history
Applied pull request patch https://github.com/magento/magento2/pull/11069.patch (created by @Echron) based on commit(s):
  1. c3ea1f5
  2. 0c0393d
  3. a986aa9
  4. eb63bbb

Fixed GitHub Issues in 2.3-develop branch:
  - #10474: Error message in product review form not being translated (reported by @Kivike)
  • Loading branch information
magento-engcom-team authored Jan 29, 2018
2 parents 413f939 + 809ed03 commit 2eca1d0
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/code/Magento/Review/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,4 @@ Summary,Summary
"Allow Guests to Write Reviews","Allow Guests to Write Reviews"
Active,Active
Inactive,Inactive
"Please select one of each of the ratings above.","Please select one of each of the ratings above."
5 changes: 3 additions & 2 deletions app/code/Magento/Review/view/frontend/templates/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
id="<?= $block->escapeHtmlAttr($_rating->getRatingCode()) ?>_<?= $block->escapeHtmlAttr($_option->getValue()) ?>"
value="<?= $block->escapeHtmlAttr($_option->getId()) ?>"
class="radio"
data-validate="{required:true, messages:{required:'Please select one of each of the ratings above.'}}"
data-validate="{'rating-required':true}"
aria-labelledby="<?= $block->escapeHtmlAttr($_rating->getRatingCode()) ?>_rating_label <?= $block->escapeHtmlAttr($_rating->getRatingCode()) ?>_<?= $block->escapeHtmlAttr($_option->getValue()) ?>_label" />
<label
class="rating-<?= $block->escapeHtmlAttr($iterator) ?>"
Expand Down Expand Up @@ -85,7 +85,8 @@
"Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?>
},
"#review-form": {
"Magento_Review/js/error-placement": {}
"Magento_Review/js/error-placement": {},
"Magento_Review/js/validate-review": {}
}
}
</script>
Expand Down
18 changes: 18 additions & 0 deletions app/code/Magento/Review/view/frontend/web/js/validate-review.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

define([
'jquery',
'jquery/ui',
'jquery/validate',
'mage/translate'
], function ($) {
'use strict';

$.validator.addMethod(
'rating-required', function (value) {
return value !== undefined;
}, $.mage.__('Please select one of each of the ratings above.'));
});

0 comments on commit 2eca1d0

Please sign in to comment.