2

After adding an item into cart if we goto mini cart and click on remove item a confirmation popup with Ok and Cancel option will appear. I am not able to translate the Ok and Cancel buttons.

Please guide me how to do this. Thanks in advance.

4
  • On which language you want to translate? Jul 12, 2018 at 12:51
  • to german and french Jul 12, 2018 at 13:05
  • Did you solve this?
    – soofz
    Apr 17, 2019 at 7:49
  • No, i didn't get the answer. Apr 23, 2019 at 9:38

2 Answers 2

1

Minicart confirmation popup button text Ok and Cancel option comes to the below file path. You can able to find that two button text form there.

File path: magento/vendor/magento/module-ui/view/base/web/js/modal/confirm.js

buttons: [{
    text: $t('Cancel'),
    class: 'action-secondary action-dismiss',

    /**
     * Click handler.
     */
    click: function (event) {
        this.closeModal(event);
    }
}, {
    text: $t('OK'),
    class: 'action-primary action-accept',

    /**
     * Click handler.
     */
    click: function (event) {
        this.closeModal(event, true);
    }
}]
0

https://github.com/magento/magento2/issues/17193 Magento 2.3.0. This fix cant resolve the issue for me. I fixed it via adding translation in template and variables:

vendor/magento/module-ui/view/base/web/templates/modal/modal-popup.html

        <footer class="modal-footer">
        <% _.each(data.buttons, function(button) { %>
        <button
            class="<%- button.class %>"
            type="button"
            data-role="action"><span><%= jQuery.mage.__(button.text) %></span></button>
        <% }); %>
    </footer>

and

vendor/magento/module-ui/view/base/web/js/modal/confirm.js

], function ($, _, $t) {
'use strict';

var cancelBtn = $t('Cancel');
var okBtn = $t('Ok');

and then

            buttons: [{
            text: cancelBtn,
            class: 'action-secondary action-dismiss',

            /**
             * Click handler.
             */
            click: function (event) {
                this.closeModal(event);
            }
        }, {
            text: okBtn,
            class: 'action-primary action-accept',

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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