# 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.

`composer require matusstafura/magento2-email-translation-checker`

Canonical URL: https://packagento.com/matusstafura/magento2-email-translation-checker

## At a glance

- **Vendor**: matusstafura (https://packagento.com/matusstafura.md)
- **Latest version**: v0.1.0 — released 2026-07-15
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/matusstafura/magento2-email-translation-checker and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require matusstafura/magento2-email-translation-checker:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Dev CLI tool to render Magento 2 transactional emails per store view, for spotting missing or untranslated content. Not intended for production use.

## 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 expose `bin/magento` to 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):

```bash
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:**
```bash
bin/magento email:check-translations --list
```

**Check one email for a store:**
```bash
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):
```bash
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:
```bash
bin/magento email:check-translations --store=3 --email=order_new --theme=Vendor/theme_code
```
See registered theme paths with:
```bash
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:
```bash
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:
```bash
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`, and `creditmemo` groups 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](LICENSE).

## Recent Versions

| Version | Released |
|---|---|
| v0.1.0 | 2026-07-15 |

## Dependencies

### Require

| 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 |

## Quality

Latest release (v0.1.0) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | Pass | Pass |


### Code Quality

Advisory checks against the module's source. Never affect the Compatibility verdict — 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.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 28 | 28 warnings (ruleset: Magento2) |
| PHPMD | Pass | 0 |  |
| Cpd | Pass | 0 |  |
| Composer validate | Info | 7 | valid; 7 advisory notes (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| Magento | PHP 8.2 | PHP 8.3 | PHP 8.4 | PHP 8.5 |
|---|---|---|---|---|
| 2.4.7 | 3 | 3 | – | – |
| 2.4.8 | – | 3 | 3 | – |
| 2.4.9 | – | – | 3 | 3 |


### Tests

Unit and integration suites run per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### 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

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["matusstafura/magento2-email-translation-checker"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

matusstafura is a Magento 2 vendor on Packagento. See https://packagento.com/matusstafura.md for their full catalogue.

