Skip to main content
added 651 characters in body
Source Link
Jaimin Sutariya
  • 11.1k
  • 5
  • 36
  • 71

You can try below code.

Option 1:

$response = $this->prepareResponse([
    'status' => 'SUCCESS',
    'message' => $this->__('Your package was added to cart'),
]);

Option 2

If above code is not working then you can use below. Add below in your view.phtml before your javascript code

<script type="text/javascript">
Translator.add('Your package was added to cart','<?php echo $this->__("Your package was added to cart")?>');
</script>

Now in your Ajax code.

try {
    $j.ajax({
         ...
        success: function(data){
            $j('product-a2c-popup popup-content span.content').text(Translator.translate(data.message));

You can also make sure by echoing <?php echo $this->__("Your package was added to cart")?> in phtml if the translation is working.

You can try below code.

$response = $this->prepareResponse([
    'status' => 'SUCCESS',
    'message' => $this->__('Your package was added to cart'),
]);

You can try below code.

Option 1:

$response = $this->prepareResponse([
    'status' => 'SUCCESS',
    'message' => $this->__('Your package was added to cart'),
]);

Option 2

If above code is not working then you can use below. Add below in your view.phtml before your javascript code

<script type="text/javascript">
Translator.add('Your package was added to cart','<?php echo $this->__("Your package was added to cart")?>');
</script>

Now in your Ajax code.

try {
    $j.ajax({
         ...
        success: function(data){
            $j('product-a2c-popup popup-content span.content').text(Translator.translate(data.message));

You can also make sure by echoing <?php echo $this->__("Your package was added to cart")?> in phtml if the translation is working.

Source Link
Jaimin Sutariya
  • 11.1k
  • 5
  • 36
  • 71

You can try below code.

$response = $this->prepareResponse([
    'status' => 'SUCCESS',
    'message' => $this->__('Your package was added to cart'),
]);