magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.48k stars 9.29k forks source link

Changing form validation options loses validation messages translations #21891

Closed gianisimone closed 5 years ago

gianisimone commented 5 years ago

Preconditions (*)

  1. Magento 2.3.0

Steps to reproduce (*)

  1. Install a new language package on your store (I am working with the Italian locale).
  2. Use the new installed language on your store.
  3. Override the Magento_Catalog/templates/product/view/form.phtml template in your custom theme
  4. Add custom validation settings for the form within this file. I did it in this way:
    <script type="text/javascript">
    var dataForm = $('#product_addtocart_form');
    dataForm.mage('validation', {
        errorPlacement: function(error, element) {
            if (element.siblings('.attribute-link-wrapper').length > 0) {
                error.insertAfter(element.siblings('.attribute-link-wrapper'));
            }
            else {
                error.insertAfter(element);
            }
        }
    });
    </script>
  5. Try to submit the form without filling all the required information. You can try in the configurable product page.

Expected result (*)

  1. The error messages relative to the missing field are shown in the current locale.

Actual result (*)

  1. The error messages relative to the missing field are shown in the default locale (English). Also, all the other forms, show error messages in the default locale instead of the current one.
magento-engcom-team commented 5 years ago

Hi @gianisimone. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

For more details, please, review the Magento Contributor Assistant documentation.

@gianisimone do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

hostep commented 5 years ago

@gianisimone: this sounds like a duplicate of https://github.com/magento/magento2/issues/21204, do you agree?

When testing the other ticket myself, it looked like it is broken in 2.3.0 but is fixed on the 2.3-develop branch, so I'm hoping that the fix will be included in 2.3.1 (should get released next week somewhere)

gianisimone commented 5 years ago

@hostep I think it is a little bit different. In my case error messages translations work if I comment out the piece of code where I customize the errorPlacement callback. Without that part of code translations work fine for me.

m2-assistant[bot] commented 5 years ago

Hi @engcom-backlog-nazar. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

ghost commented 5 years ago

hI @gianisimone thank you for you report, this issue has already fixed in 2.3.1 release. thanks for collaboration :+1: DeepinScreenshot_select-area_20190412104926