matusstafura / magento2-email-translation-checker
Dev CLI tool to render Magento 2 transactional emails per store view, for spotting missing or untranslated content. Not intended for production use.
MatusStafura_EmailTranslationChecker
A Magento 2 CLI tool that renders a transactional email exactly as a given store view would send it — subject, body, and the full HTML — so you can spot missing or untranslated content without waiting for a real customer action to trigger the email.
⚠️ Development tool. Not intended for production use.
It renders real order/customer data into terminal output and writes rendered HTML files tovar/email-translation-checker/. Don't install this on a production deployment, and don't exposebin/magentoto untrusted users.
Why
Magento resolves transactional emails per store view through a chain of config paths, theme fallback, and (for untouched system templates) locale-based {{trans}} CSV translation. There's no built-in way to just see what a given store view actually sends — you either trigger a real email, or dig through Admin > System > Transactional Emails and theme folders by hand. This tool renders it directly, on demand.
Requirements
- Magento 2.4.x
- PHP 8.1+
Install
Via Composer (recommended):
composer require matusstafura/magento2-email-translation-checker --dev
bin/magento module:enable MatusStafura_EmailTranslationChecker
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
Or manually: copy this repo into app/code/MatusStafura/EmailTranslationChecker, then run the same module:enable / setup:upgrade / setup:di:compile / cache:flush steps.
Usage
List all known email codes:
bin/magento email:check-translations --list
Check one email for a store:
bin/magento email:check-translations --store=3 --email=order_new
Prints the resolved subject and a readable plain-text body, and saves the full rendered HTML to var/email-translation-checker/store3_order_new.html.
Use a specific real order as sample data (otherwise the latest order placed in that store is auto-picked):
bin/magento email:check-translations --store=3 --email=order_new --order-id=123456
Force a specific theme, independent of what the store is actually configured to use — handy for A/B-checking theme overrides:
bin/magento email:check-translations --store=3 --email=order_new --theme=Vendor/theme_code
See registered theme paths with:
bin/magento email:check-translations --list-themes
Bypass theme/config resolution entirely and render one exact file — useful once you already know which file you want to check:
bin/magento email:check-translations --store=3 --email=order_new --file=app/design/frontend/Vendor/theme/Magento_Sales/email/order_new.html
Verbose mode (-v) additionally prints the config path, whether the template is a system default or a custom DB template, the full theme fallback chain, the exact resolved file path, and the raw order data used to fill in variables — useful when a value renders blank and you need to know whether it's a translation gap or missing source data:
bin/magento email:check-translations --store=3 --email=order_new -v
How it works
- Resolves the store-scoped config path for the chosen email group (e.g.
sales_email/order/template) and determines whether it points at a custom DB template or a system-default template file. - For system-default templates, renders through Magento's real template filter (
Magento\Email\Model\Template), so{{trans}}directives resolve via that store's locale exactly as they would for a real customer — not just raw template markup. - Builds a variable set matching what Magento's own
Order\Email\Sender\*classes provide (order,order_data,billing,formattedBillingAddress, etc.), using a real order (auto-picked or specified via--order-id) so address/variable directives resolve with real data instead of blanks.
Known limitations
- The config paths in the email list are Magento 2.4.7 defaults. A third-party module or older/newer Magento version can shift a path — verify with
bin/magento config:show <path> --scope=stores --scope-code=<code>if a code reports "no template resolved." - Variable sets for
order,invoice,shipment, andcreditmemogroups are built for their standard templates. A heavily customized template referencing extra variables (check its<!--@vars {...}-->comment block) may render some values blank — that's expected, not a translation bug. - Newsletter and account emails use placeholder customer data (
Test Customer/[email protected]), not a real customer lookup.
License
MIT — see LICENSE.
No changelog yet
The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.
Requires 8
| Package | Constraint |
|---|---|
| magento/framework | * |
| magento/module-customer | * |
| magento/module-email | * |
| magento/module-newsletter | * |
| magento/module-sales | * |
| magento/module-store | * |
| magento/module-theme | * |
| php | >=8.1 |
Compatibility
Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.
Code Quality
Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge. A phpcs finding can't make a module incompatible.
Static analysis
Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.
Tests
Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.
Unit tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Integration tests
| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | N/A | N/A | ||
| 2.4.8 | N/A | N/A | ||
| 2.4.9 | N/A | N/A |
Security
Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.
More from matusstafura
View vendorPhone validation for Magento 2
Vat Id input validation for Magento 2
Universal category redirect module for Magento 2 - creates store-agnostic category links using category ID
Product redirect module for Magento 2 - creates store-agnostic product links using SKU or ID
Turn an existing module into recurring revenue.
If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.