PHPackages                             phpro/mage2-module-translations - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Localization &amp; i18n](/categories/localization)
4. /
5. phpro/mage2-module-translations

ActiveMagento2-module[Localization &amp; i18n](/categories/localization)

phpro/mage2-module-translations
===============================

Manage translations via the Magento backend

1.7.0(11mo ago)16109.1k↓40.3%14[2 issues](https://github.com/phpro/phpro-mage2-module-translations/issues)[1 PRs](https://github.com/phpro/phpro-mage2-module-translations/pulls)MITPHPPHP ^8.1CI passing

Since Jan 28Pushed 11mo ago5 watchersCompare

[ Source](https://github.com/phpro/phpro-mage2-module-translations)[ Packagist](https://packagist.org/packages/phpro/mage2-module-translations)[ RSS](/packages/phpro-mage2-module-translations/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (9)Versions (17)Used By (0)

[![](https://github.com/phpro/phpro-mage2-module-translations/workflows/.github/workflows/grumphp.yml/badge.svg)](https://github.com/phpro/phpro-mage2-module-translations/workflows/.github/workflows/grumphp.yml/badge.svg)

[![](https://camo.githubusercontent.com/eecc88f1abdaadd76a66b53257757773fba7a478c38c298ce9d4c9d6e8a163a4/68747470733a2f2f736869656c64732e696f2f62616467652f4879762543332541345f5468656d652d436f6d70617469626c652d2d2d3f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d46364637464626636f6c6f723d304232334239266c6f676f436f6c6f723d304232334239266c6f676f3d646174613a696d6167652f7376672b786d6c3b6261736536342c50484e325a79423361575230614430694d6a51694947686c6157646f644430694d6a5169494868746247357a50534a6f644852774f693876643364334c6e637a4c6d39795a7938794d4441774c334e325a79492b50484268644767675a44306954546b754e6a493149446b754e7a646a4d53347a4e5455744d5334774e4463674d7934774d4467744d5334334d4463674e4334344e6a63744d5334334d4463674d7934344d4455674d4341334c6a55774f4341794c6a4d324e7941334c6a55774f4341344c6a517a4d3159794e4767744e4334344e6a64324c5463754e544130597a41744d7934784d6a6b744d5334314d6a67744e43347a4d4467744d7934324d544d744e43347a4d4467744d5334334d6a4d674d4330794c6a6b334d7934354e69307a4c6a59324f4341784c6a6b334e6c59794e4567304c6a6b324e5659304c6a557a4d55677954444d754e54597a4944426f4e6934774e6a4a324f5334334e33704e4d5459754e6a51674d4567794d6d77744d5334314e7941304c6a557a4d5767744e53347a4e544a4d4d5459754e6a51674d486f694c7a34384c334e325a7a344b)](https://camo.githubusercontent.com/eecc88f1abdaadd76a66b53257757773fba7a478c38c298ce9d4c9d6e8a163a4/68747470733a2f2f736869656c64732e696f2f62616467652f4879762543332541345f5468656d652d436f6d70617469626c652d2d2d3f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d46364637464626636f6c6f723d304232334239266c6f676f436f6c6f723d304232334239266c6f676f3d646174613a696d6167652f7376672b786d6c3b6261736536342c50484e325a79423361575230614430694d6a51694947686c6157646f644430694d6a5169494868746247357a50534a6f644852774f693876643364334c6e637a4c6d39795a7938794d4441774c334e325a79492b50484268644767675a44306954546b754e6a493149446b754e7a646a4d53347a4e5455744d5334774e4463674d7934774d4467744d5334334d4463674e4334344e6a63744d5334334d4463674d7934344d4455674d4341334c6a55774f4341794c6a4d324e7941334c6a55774f4341344c6a517a4d3159794e4767744e4334344e6a64324c5463754e544130597a41744d7934784d6a6b744d5334314d6a67744e43347a4d4467744d7934324d544d744e43347a4d4467744d5334334d6a4d674d4330794c6a6b334d7934354e69307a4c6a59324f4341784c6a6b334e6c59794e4567304c6a6b324e5659304c6a557a4d55677954444d754e54597a4944426f4e6934774e6a4a324f5334334e33704e4d5459754e6a51674d4567794d6d77744d5334314e7941304c6a557a4d5767744e53347a4e544a4d4d5459754e6a51674d486f694c7a34384c334e325a7a344b)

Translation module for Magento 2
================================

[](#translation-module-for-magento-2)

The `Phpro_Translations` module helps you to manage translations via the Magento backend.

Features
--------

[](#features)

- Simple backend CRUD to manage translations
- Single and multi-inline editing via the grid-overview
- Import and export via CSV files via CLI
- Import and export via default Magento import/export functionality
- Prepare new translations via data patch scripts
- (Re)generate frontend translations (JSON translation files) via CLI and backend

Installation
------------

[](#installation)

```
composer require phpro/mage2-module-translations

```

End user documentation
----------------------

[](#end-user-documentation)

[Download the end user documentation (PDF)](./resources/phpro-translation-module-EUD.pdf)

Usage (technical)
-----------------

[](#usage-technical)

### Locales

[](#locales)

All locales must be defined in an ISO format. Locale = ISO-639 (language) + "\_" + ISO-3166 (country).

Examples of locales: en\_US, nl\_BE, nl\_NL, fr\_BE, de\_DE, ...

### Import and export

[](#import-and-export)

#### Import Magento translation CSVs

[](#import-magento-translation-csvs)

CSV structure must be (key, value):

```
"Transkey 1","Transvalue 2"
"Transkey 2","Transvalue 2"
...

```

Use the `phpro:translations:import` command to import a CSV file for a given locale. Duplicate records are skipped and no updates are applied.

```
bin/magento phpro:translations:import /path/to/cs_CZ/cs_CZ.csv cs_CZ --clear-cache

```

Output:

```
Importing CSV file /path/to/cs_CZ/cs_CZ.csv for locale cs_CZ
#created: 193
#skipped: 4
#failed: 0
Caches cleared: full_page, block_html, translate
Done!

```

#### Export to CSV

[](#export-to-csv)

Use the `phpro:translations:export` command to export database translations to a CSV file for one or more locales. Separate multiple locales with a space. The exported CSV file is written in the `var/translations` folder of Magento.

```
bin/magento phpro:translations:export nl_BE cs_CZ

```

Output:

```
Exporting translations to CSV file
Csv file: /path/to/var/translations/20190531_085402_export_nl_BE_cs_CZ.csv
Total written rows: 390
Done!

```

CSV structure:

```
"New Account","Nieuwe account",nl_BE
"My Wish List","Mijn verlanglijst",nl_BE
"New Account","Nový účet",cs_CZ
"My Wish List","Mé oblíbené",cs_CZ
...

```

#### Import CSV (including locale)

[](#import-csv-including-locale)

You can use the exported CSV file(s) to import on another environment. For example you can prepare new translations on a staging environment and import them later on a production environment.

CSV structure must be (key, value, locale):

```
"Transkey 1","Transvalue 2",nl_BE
"Transkey 2","Transvalue 2",nl_BE
"Transkey 1","Transvalue 2",fr_BE
"Transkey 2","Transvalue 2",fr_BE
...

```

Use the `phpro:translations:import-full` command to import a CSV file. Duplicate records are skipped and no updates are applied.

```
bin/magento phpro:translations:import-full /path/to/full_import_nl_BE_cs_CZ.csv --clear-cache

```

Output:

```
Importing CSV file /path/to/full_import_nl_BE_cs_CZ.csv
#created: 10
#skipped: 380
#failed: 0
Caches cleared: full_page, block_html, translate
Done!

```

#### Import via backend

[](#import-via-backend)

Go to System → (Data Transfer) → Import to create or update translations based on a CSV file. Please reach out our end user documentation.

### Re-generate frontend translations

[](#re-generate-frontend-translations)

Generating/re-generating frontend translation will generate JSON file(s) which includes all the frontend/JS translations. These files are stored in the `pub/media/phpro_translations` directory in their related theme/locale subdirectory.

#### Via backend

[](#via-backend)

- Go to "Translations -&gt; Generate frontend translations" in the admin. Select "all store views" or select specific ones. Click the button "Generate translations files".
- Clear full page and block html caches via "System -&gt; Cache Management".
- Also check the end user documentation

#### Via CLI

[](#via-cli)

- Use the `phpro:translations:generate-frontend-translations` command to re-generate new JSON file(s)
- Make sure you clean full\_page and block\_html cache manually afterwards to apply and enable the newest translation JSON file for the storefront.

**Re-generate for single store view**

Specify the `storeId` argument to re-generate for specific store view (locale). Use the `bin/magento store:list` command to show the store IDs.

```
bin/magento phpro:translations:generate-frontend-translations 5

```

**Re-generate for all**

Leave the `storeId` argument empty to re-generate for all store views.

```
bin/magento phpro:translations:generate-frontend-translations

```

#### During build process

[](#during-build-process)

We recommend to re-generate all frontend translations during your build process with `phpro:translations:generate-frontend-translations` after the `setup:upgrade --keep-generated` step and just before deactivating maintenance.

#### Browser cache optimizations

[](#browser-cache-optimizations)

The translations JSON files are stored in the directory `pub/media/phpro_translations` with a specific version string. You can choose to have a these files optimally cached by browsers by configuring the Cache-Control header. A ngnix example below:

```
location /media/phpro_translations/ {
    add_header X-Frame-Options "SAMEORIGIN";
    add_header Cache-Control "public";
    expires +1y;
}

```

### Collect translations from code base

[](#collect-translations-from-code-base)

Use the `phpro:translations:prepare-keys` command to collect translations phrases from the code base and prepare them. This will create a translation for every available locale.

### Add translations during development

[](#add-translations-during-development)

To prepare, create or delete translations you can inject `\Phpro\Translations\Api\TranslationDataManagementInterface` as dependency into your data patch script of your module.

#### Prepare

[](#prepare)

Add the translation key for all enabled locales of the Magento instance. If default translation is not set, the translation key will be used as default translation.

```
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\NonTransactionableInterface;
use Phpro\Translations\Model\TranslationDataManagement;

class HelloWorldTranslations implements DataPatchInterface, NonTransactionableInterface
{
    private TranslationDataManagement $translationDataManagement;

    public function __construct(
        TranslationDataManagement $translationDataManagement
    ) {
        $this->translationDataManagement = $translationDataManagement;
    }

    public function apply()
    {
        $this->translationDataManagement->prepare('Hello world!');
        $this->translationDataManagement->prepare('Welcome %1', 'Hello %1');
        // other translation keys here...
    }
}

```

#### Create

[](#create)

Add a translation for given locales.

```
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\NonTransactionableInterface;
use Phpro\Translations\Model\TranslationDataManagement;

class HelloWorldTranslations implements DataPatchInterface, NonTransactionableInterface
{
    private TranslationDataManagement $translationDataManagement;

    public function __construct(
        TranslationDataManagement $translationDataManagement
    ) {
        $this->translationDataManagement = $translationDataManagement;
    }

    public function apply()
    {
        $this->translationDataManagement->create('Hello world!', 'Hallo wereld!!!', ['nl_NL', 'nl_BE']);
        $this->translationDataManagement->create('Hello world!', 'Hello world!!!', ['en_US']);
        // other translation keys here...
    }
}

```

#### Delete

[](#delete)

Delete a translation for given translation key and locale(s). In case no locales are given, all enabled locales will be used for deletion.

```
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\NonTransactionableInterface;
use Phpro\Translations\Model\TranslationDataManagement;

class DeleteHelloWorldTranslations implements DataPatchInterface, NonTransactionableInterface
{
    private TranslationDataManagement $translationDataManagement;

    public function __construct(
        TranslationDataManagement $translationDataManagement
    ) {
        $this->translationDataManagement = $translationDataManagement;
    }

    public function apply()
    {
        $this->translationDataManagement->delete('Hello world!');
        $this->translationDataManagement->delete('Welcome %1', ['nl_BE', 'nl_NL']);
        // other translation keys here...
    }
}

```

PWA
---

[](#pwa)

The checkbox "frontend" could be used to mark translations that need to be exported to a PWA installation. With a rest API call, the translations can be fetched and stored in the PWA translations files.

### API call that can be used in build scripts

[](#api-call-that-can-be-used-in-build-scripts)

```
curl -G -k -H "Authorization: Bearer " --data-urlencode "searchCriteria[filter_groups][0][filters][0][field]=frontend" --data-urlencode "searchCriteria[filter_groups][0][filters][0][value]=1" --data-urlencode "searchCriteria[filter_groups][1][filters][0][field]=locale" --data-urlencode "searchCriteria[filter_groups][1][filters][0][value]=" rest/V1/phpro-translations/translation/search

```

Hyvä
----

[](#hyvä)

Install the Hyvä compatibilty module. Minimum version is 1.2.3.

```
composer require hyva-themes/magento2-phpro-translations

```

###  Health Score

48

—

FairBetter than 93% of packages

Maintenance48

Moderate activity, may be stable

Popularity43

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 56.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Total

15

Last Release

359d ago

PHP version history (7 changes)1.0.0PHP ^7.3

1.1.0PHP ^7.3 || ^8.0

1.2.0PHP ~7.4.0||~8.1.0

1.3.0PHP ~7.4.0||^8.1

1.4.0-rc1PHP ^8.1

1.4.0PHP ^8.3

1.4.2PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/cab1b0de06c75fec5317beded0c2978f3e9e560e6830c1d9048f3e37b3287342?d=identicon)[phpro](/maintainers/phpro)

---

Top Contributors

[![siebdc2](https://avatars.githubusercontent.com/u/104489060?v=4)](https://github.com/siebdc2 "siebdc2 (57 commits)")[![BrentRobert](https://avatars.githubusercontent.com/u/6866325?v=4)](https://github.com/BrentRobert "BrentRobert (11 commits)")[![MaximGanses](https://avatars.githubusercontent.com/u/58943509?v=4)](https://github.com/MaximGanses "MaximGanses (11 commits)")[![dylanteugels](https://avatars.githubusercontent.com/u/162726340?v=4)](https://github.com/dylanteugels "dylanteugels (9 commits)")[![vrielsa](https://avatars.githubusercontent.com/u/33426821?v=4)](https://github.com/vrielsa "vrielsa (5 commits)")[![vacla](https://avatars.githubusercontent.com/u/10290022?v=4)](https://github.com/vacla "vacla (3 commits)")[![kimb0na](https://avatars.githubusercontent.com/u/170505996?v=4)](https://github.com/kimb0na "kimb0na (2 commits)")[![stefliekens](https://avatars.githubusercontent.com/u/3245491?v=4)](https://github.com/stefliekens "stefliekens (2 commits)")[![jokeputs](https://avatars.githubusercontent.com/u/5744027?v=4)](https://github.com/jokeputs "jokeputs (1 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/phpro-mage2-module-translations/health.svg)

```
[![Health](https://phpackages.com/badges/phpro-mage2-module-translations/health.svg)](https://phpackages.com/packages/phpro-mage2-module-translations)
```

###  Alternatives

[mollie/magento2

Mollie Payment Module for Magento 2

1131.9M16](/packages/mollie-magento2)[opengento/module-category-import-export

This module add the capability to import and export the categories from the back-office.

1310.9k2](/packages/opengento-module-category-import-export)[buckaroo/magento2

Buckaroo Magento 2 extension

32420.3k8](/packages/buckaroo-magento2)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1011.8k26](/packages/loki-magento2-components)[mage-os/module-admin-activity-log

The Admin Activity extension makes it easy to track all admin activity with comprehensive audit logging.

296.3k1](/packages/mage-os-module-admin-activity-log)[zwernemann/module-withdrawal

Magento 2 EU Withdrawal Button Module - Adds a withdrawal/revocation button for orders in compliance with EU Directive (EU) 2023/2673

244.9k2](/packages/zwernemann-module-withdrawal)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
