0

does anyone know where the Locale of the Stock alert is located in Magento 2.4.4.?

I want to translate those strings in the e-mail:

In stock alert! We wanted you to know that these products are now available:

Click here to stop alerts for this product.

Unsubscribe from all stock alerts

The e-mail template looks like this:

<p class="greeting">{{trans "%name," name=$customerName}}</p>
{{var alertGrid|raw}}
1
  • which language would you like to translate email ? Jun 14 at 5:47

3 Answers 3

1

please use below code in email template to translate stock alert text, it will translate according to locale by default and we can translate it using .csv files.

<p>{{trans "In stock alert! We wanted you to know that these products are now available: Click here to stop alerts for this product. Unsubscribe from all stock alerts."}}</p>

1
  • you can also create .html template file inside your theme and call that template file into email tempate file path like this: {{template config_path="design/email/header_template"}}
    – Deep Shah
    Jun 15 at 11:20
0

alertGrid is a rendered block content

Block: \Magento\ProductAlert\Block\Email\Stock

Template: Magento_ProductAlert::email/stock.phtml

$_products - list of products which back to stock

1
  • Unfortunately I am still failing to translate the same. I have set my locale as per vendor/magento/module-inventory-product-alert/i18n but not working
    – Ben
    Jun 10 at 5:03
0
+50

The exact strings used here are found in Magento_ProductAlert::email/stock.phtml

Add the translations for it in your custom theme i18n folder, in a csv file for your language code (e.g. app/design/frontend/Your_Vendor/customtheme/i18n/nl_NL.csv and mind case-sensitivity in language code!)

"In stock alert! We wanted you to know that these products are now available:","Weer in voorraad blabla"
"Click here to stop alerts for this product.","Klik om blabla"
"Unsubscribe from all stock alerts","Afmelden voor blablabla"

Change translations according to your desired language :)

2
  • I did so @bdbdbd. But no success.
    – Ben
    Jun 14 at 9:44
  • @Ben are you in developer mode and cleared the cache and generated files? Or try bin/magento setup:static-content:deploy nl_NL -f (where nl_NL is your language code).
    – bdbdbd
    Jun 15 at 10:14

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.