M2 - Translate newsletter status message
-
10-03-2021 - |
题
I need to translate this message:
{"status":"OK","msg":"Thank you for your subscription."}
I've done a search in all the files but I cannot find this string to translate... I have a Ajax notification when you subscribe for a newsletter, but I need to translate "Thank you for your subscription."
I've already entered the sentence into the i18n nl_NL.csv file but with no result so far...
解决方案
The initial code is being set in
vendor/magento/module-newsletter/Controller/Subscriber/NewAction.php
In your theme if you have added the translate to i18n/nl_NL.csv and you have run
bin/magento setup:upgrade
bin/magento setup:static-content:deploy en_US nl_NL
Then the only alternative i can see is to extend or overwrite that controller to change the message but this is only if the locale file has not updated what is there also make sure you do not edit core files always extend them in your own custom extension under the app/code folder of magento