# hyva-themes/magento2-i18n-csv-diff

> Magento command to display all translations that are present in the first CSV file but not in the second.

`composer require hyva-themes/magento2-i18n-csv-diff`

Canonical URL: https://packagento.com/hyva-themes/magento2-i18n-csv-diff

## At a glance

- **Vendor**: hyva-themes (https://packagento.com/hyva-themes.md)
- **Latest version**: 1.0.2 — released 2023-08-11
- **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/hyva-themes/magento2-i18n-csv-diff 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 hyva-themes/magento2-i18n-csv-diff:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Magento command to display all translations that are present in the first CSV file but not in the second.

## README

[![Hyvä Themes](https://repository-images.githubusercontent.com/300568807/f00eb480-55b1-11eb-93d2-074c3edd2d07)](https://hyva.io/)

### hyva-themes/magento2-i18n-csv-diff

![Supported Magento Versions][ico-compatibility]

This module adds the `bin/magento i18n:diff-csv` and `i18n:translate-csv` commands.

#### i18n:diff-csv

The command takes two CSV files as arguments.    
It displays all translations that are present in the first CSV file but not in the second.

#### i18n:translate

The command takes a target language 2-letter ISO code as the argument.  
It reads a Magento localization CSV dictionary from stdin, translates it using the DeepL API, and writes it to stdout.  
Be sure to check the automatic translations afterwards! 

### Usage Examples:

* Collect all Magento and Hyvä strings:
    ```sh
    bin/magento i18n:collect-phrases vendor/magento/ > magento-strings.csv
    bin/magento i18n:collect-phrases vendor/hyva-themes/magento2-default-theme/ > hyva-strings.csv
    bin/magento i18n:collect-phrases vendor/hyva-themes/magento2-theme-module/ >> hyva-strings.csv
    ```
* Find all Hyvä specific translations that are not part of native Magento:
    ```sh
    bin/magento i18n:diff-csv hyva-strings.csv magento-strings.csv
    ```

* Find all translations that are missing in a Hyvä translation file:
    ```sh
    bin/magento i18n:diff-csv hyva-strings.csv i18n/de_DE.csv
    ```
* Find all translations that are in a translation file but are not used in Hyvä:
    ```sh
    bin/magento i18n:diff-csv i18n/de_DE.csv hyva-strings.csv
    ```
* Add new translations to an existing dictionary file.
    ```sh
    bin/magento i18n:diff-csv hyva-strings.csv i18n/de_DE.csv | bin/magento i18n:translate-csv DE >> i18n/de_DE.csv
    ```

### Installation
  
1. Install via composer
    ```
    composer require hyva-themes/magento2-i18n-csv-diff
    ```
2. Enable module
    ```
    bin/magento setup:upgrade
    ```

### Configuration
  
To use the Deep`i18n:translate-csv` command, configure your [API key](https://www.deepl.com/pro-api?cta=header-pro-api/) in the system configuration at *Hyva Themes > Localization CLI > Translation > DeepL API Key*. 

### License

The BSD-3-Clause License. Please see [License File](LICENSE.txt) for more information.

[ico-compatibility]: https://img.shields.io/badge/magento-%202.3%20|%202.4-brightgreen.svg?logo=magento&longCache=true&style=flat-square

## Recent Versions

| Version | Released |
|---|---|
| 1.0.2 | 2023-08-11 |
| 1.0.1 | 2022-04-03 |
| 1.0.0 | 2022-04-01 |

## Dependencies

### Require

| Package | Constraint |
|---|---|
| php | >=7.4.0 |

## Quality

Latest release (1.0.2) 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 | – | – | 1 | 1 |


### 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 | 1 | 1 warning (ruleset: Magento2) — 1 auto-fixable with phpcbf |
| PHPMD | Pass | 0 |  |
| Cpd | Pass | 0 |  |
| Composer validate | Pass | 0 |  |

#### 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 | Pass | Pass | – | – |
| 2.4.8 | – | Pass | Pass | – |
| 2.4.9 | – | – | 2 | 2 |


### 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=["hyva-themes/magento2-i18n-csv-diff"],
  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

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

