Jump to content

After Changing error notification string in CartController.php the said string does not index in Translation.


prestaKar

Recommended Posts

To simply put I created this code in the screen.

The new error notification in cart appears, but only in english, which i thought would not be a problem. However after browsing through every translation (backoffice, page, module, etc) I could not find this changed string to translate.
Of course i cleared cache, then even deleted cache folder. But nothing. I tried chcecking out the translation/pl-pl/ShopNotificationsError.pl-PL.xlf file, but there is nothing there, instead there is one that was before i changed the code.

I would appricate help, or a little step by step tutorial how should it be done
 

obraz.png

Link to comment
Share on other sites

4 minutes ago, endriu107 said:

Where you add this code? In module files?

Inside the %domain-name%/controllers/front/CartController.php

I know i should create override, but when i followed other tutorials it didnt work. meanwhile here it worked instantly. However now i have issue with translation.

I basically just changed that string, and added [... , %product%  => $productName, ...]

obraz.thumb.png.581b1776e1efa445fe46a3246be1f7a8.png
 

Edited by prestaKar (see edit history)
Link to comment
Share on other sites

Ok, I just check it and have same issue. You can add manually this string to translation/default/ShopNotificationsError.xlf after:

<file original="controllers/front/CartController.php" source-language="en-US" target-language="en" datatype="plaintext">
    <body>
     

If you still have issue with override file you need to create file in override/controllers/front/CartControllers.php

<?php

class CartController extends CartControllerCore
{
    protected function processChangeProductInCart(): void
    {
        //Here all code from this method
    }
}

 

Link to comment
Share on other sites

17 hours ago, endriu107 said:

Ok, I just check it and have same issue. You can add manually this string to translation/default/ShopNotificationsError.xlf after:

<file original="controllers/front/CartController.php" source-language="en-US" target-language="en" datatype="plaintext">
    <body>
     

If you still have issue with override file you need to create file in override/controllers/front/CartControllers.php

<?php

class CartController extends CartControllerCore
{
    protected function processChangeProductInCart(): void
    {
        //Here all code from this method
    }
}

 

The first part worked, i added under the
"<file original="controllers/front/CartController.php" source-language="en-US" target-language="en" datatype="plaintext">
    <body>"

<trans-unit id="*md5 hash of string*">
        <source>Sorry, "%product%" is not available in this quantity.</source>
        <target>Sorry, "%product%" is not available in this quantity.</target>
        <note>Line: 546</note>
</trans-unit>

in the translation/default/ShopNotificationsError.xlf and the text finally showed up available for translation.

Thank you very much.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...