matusstafura/magento2-email-translation-checker
Composer 安装命令:
composer require 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.
README 文档
README
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 to
var/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/test@example.com), not a real customer lookup.
License
MIT — see LICENSE.
matusstafura/magento2-email-translation-checker 适用场景与选型建议
matusstafura/magento2-email-translation-checker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 07 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 matusstafura/magento2-email-translation-checker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 matusstafura/magento2-email-translation-checker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-15