PHPackages                             itk-dev/drupal\_translation\_extractor - 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. itk-dev/drupal\_translation\_extractor

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

itk-dev/drupal\_translation\_extractor
======================================

drupal\_translation\_extractor

1.2.0(4mo ago)03.4k↓68%[1 PRs](https://github.com/itk-dev/drupal_translation_extractor/pulls)MITPHPPHP ^8.3CI passing

Since Jan 8Pushed 4mo agoCompare

[ Source](https://github.com/itk-dev/drupal_translation_extractor)[ Packagist](https://packagist.org/packages/itk-dev/drupal_translation_extractor)[ RSS](/packages/itk-dev-drupal-translation-extractor/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (17)Versions (7)Used By (0)

Translation extractor
=====================

[](#translation-extractor)

Extracts translations from PHP files, Twig templates and JavaScripts files.

This Drupal translation extractor stands on the shoulders of giants:

-
- [https://www.drupal.org/project/translation\_extractor](https://www.drupal.org/project/translation_extractor)
-

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

[](#installation)

```
composer require --dev itk-dev/drupal_translation_extractor:^1.0
drush pm:install drupal_translation_extractor
```

Use
---

[](#use)

The main entrypoint is the `drupal_translation_extractor:translation:extract` Drush command. This command is basically Symfony's [`translation:extract` console command](https://symfony.com/doc/current/translation.html#extracting-translation-contents-and-updating-catalogs-automatically)with a few changes and additions outlined below.

Changes from the Symfony commandThe `bundle` argument doesn't make sense and has been removed.

The `--clean` option is a [NOP](https://en.wikipedia.org/wiki/NOP_(code)) since it doesn't make sense for our use. We always write only existing translations.

A new argument has been added:

`source` The source path to extract translations from. For convenience, `module:«name»` and `theme:«name»` can be used in the value and will be expanded to the full path to the module and/or theme respectively, i.e. `module:my_custom_module` will be expanded to `web/modules/custom/my_custom_module`, say.

A new option has been added:

`--output` The output path. The value can use these placeholders:

NameValue`%locale`The locale being extracted`%module`The module name if specified using `module:…` in `source``%source_dir`The directory of `%source``%source`The expanded value of `source``%theme`The theme name if specified using `theme:…` in `source``%language`[1](#user-content-fn-1-efeb28f9c50f6fb1c6fe2ea4e9298f9b)Alias for `%locale``%project` [1](#user-content-fn-1-efeb28f9c50f6fb1c6fe2ea4e9298f9b)Alias for either `%module` or `%theme` (whichever is set)### Example

[](#example)

Running

```
drush drupal_translation_extractor:translation:extract da --dump-messages --force module:my_modules --output=%source/translation/%module.%locale.po
```

will find translations in all PHP, Twig and JavaScript files in the `web/modules/custom/my_module` directory and write the result to `web/modules/custom/my_module/translation/my_module.da.po`.

Note

Much of the code in this module is stolen frombased on Symfony components and therefore we do not use Drupal coding standards.

Footnotes
---------

1. Matching placeholders used the Locale module (cf. [locale.api.php](https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/locale/locale.api.php)). [↩](#user-content-fnref-1-efeb28f9c50f6fb1c6fe2ea4e9298f9b) [↩2](#user-content-fnref-1-2-efeb28f9c50f6fb1c6fe2ea4e9298f9b)

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance77

Regular maintenance activity

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~26 days

Total

3

Last Release

124d ago

PHP version history (2 changes)1.0.0PHP ^8.4

1.1.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/33924554?v=4)[ITK Development](/maintainers/itk-dev)[@itk-dev](https://github.com/itk-dev)

---

Top Contributors

[![rimi-itk](https://avatars.githubusercontent.com/u/11267554?v=4)](https://github.com/rimi-itk "rimi-itk (12 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/itk-dev-drupal-translation-extractor/health.svg)

```
[![Health](https://phpackages.com/badges/itk-dev-drupal-translation-extractor/health.svg)](https://phpackages.com/packages/itk-dev-drupal-translation-extractor)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

185701.7M5.6k](/packages/nesbot-carbon)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

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