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(2mo ago)01.9k↓50%[1 PRs](https://github.com/itk-dev/drupal_translation_extractor/pulls)MITPHPPHP ^8.3CI passing

Since Jan 8Pushed 2mo 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 1mo 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-95480f9187fa1c0346f80448c501bcc4)Alias for `%locale``%project` [1](#user-content-fn-1-95480f9187fa1c0346f80448c501bcc4)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-95480f9187fa1c0346f80448c501bcc4) [↩2](#user-content-fnref-1-2-95480f9187fa1c0346f80448c501bcc4)

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance85

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity53

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

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

[nesbot/carbon

An API extension for DateTime that supports 281 different languages.

169661.4M4.8k](/packages/nesbot-carbon)[lexik/translation-bundle

This bundle allows to import translation files content into the database and provide a GUI to edit translations.

4362.7M19](/packages/lexik-translation-bundle)[jms/translation-bundle

Puts the Symfony Translation Component on steroids

42510.8M63](/packages/jms-translation-bundle)[symfony/ux-translator

Exposes Symfony Translations directly to JavaScript.

26594.0k3](/packages/symfony-ux-translator)[symfony/crowdin-translation-provider

Symfony Crowdin Translation Provider Bridge

13488.9k1](/packages/symfony-crowdin-translation-provider)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1537.5k](/packages/bacula-web-bacula-web)

PHPackages © 2026

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