1

I have a question about Action Translate in the JS file.

I already added this code

define([
    'jquery',
    'Magento_Ui/js/modal/modal',
    'mage/mage',
    'mage/translate'
],

but about "Go, Pending, Accepted, Rejected" action button not Translate still

about action button code:

please help, let me know the reason, please. thank you!

4

You should call the translate function like below

require(['jquery', 'jquery/ui', 'mage/translate'],function($){
    $(classRefund).html($.mage.__('Pending'));
});

According to your script

    if ($.inArray(status, array) !== -1) {
            var text = $.mage.__('Go');
            $(this).find('.col.actions').append("<span class='a123'><a href='#' class='123'>"+text+"</a></span>");
        }

    var buttonPos = "tr[data-oder-id="+col1+"] td.col.actions";
    $.each(data, function(key, value) {
        var classRefund = buttonPos + ' ' + 'span.refund';
        if (col1 == value.increment_id && value.refund_status == 0) {
            $(classRefund).html($.mage.__('Pending'));
        }
        if (col1 == value.increment_id && value.refund_status == 1) {
            $(classRefund).html($.mage.__('Accepted'));
        }
        if (col1 == value.increment_id && value.refund_status == 2) {
            $(classRefund).html($.mage.__('Rejected'));
        }
    });
2
  • 1
    You are right, Thanks your helpful – niceonelee Sep 18 '19 at 4:41
  • np....accept the answer if it is correct – Ranganathan Sep 18 '19 at 5:05

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.