PHPackages                             natxet/twig-po - 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. natxet/twig-po

ActiveLibrary[Localization &amp; i18n](/categories/localization)

natxet/twig-po
==============

Extract {%trans%} keys from twig and insert them in your PO file

22.5k↓50%3[2 issues](https://github.com/natxet/twig-po/issues)PHP

Since Nov 9Pushed 10y ago1 watchersCompare

[ Source](https://github.com/natxet/twig-po)[ Packagist](https://packagist.org/packages/natxet/twig-po)[ RSS](/packages/natxet-twig-po/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

twig-po
=======

[](#twig-po)

Extract translation keys from twig templates and move them to PO

Instructions
------------

[](#instructions)

Fork and install (you need composer for that!):

```
git clone git@github.com:natxet/twig-po.git
cd twig-po
composer install

```

Then, go to folder and execute:

```
./console find:tags /path/to/twig/templates  /path/to/messages.po Po -d -v -o

```

Once you see that nothing wrong is going to happen then

```
./console find:tags /path/to/twig/templates  /path/to/messages.po Po

```

If you want to use it with other tags, for instance, for your PHP files with \_('translation')

```
./console find:tags /path/to/twig/templates  /path/to/messages.po Po -t "/_\((?: )?['\"]([^$]*)['\"](?: )?\)/muU"

```

For help:

```
./console help find:tags

```

Once you have the PO translated, convert to .mo with your editor or command line:

```
msgfmt -cv -o messages.mo messages.po

```

(Note: you need to have gettext installed for this command)

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1036236?v=4)[Nacho C.](/maintainers/natxet)[@natxet](https://github.com/natxet)

---

Top Contributors

[![natxet](https://avatars.githubusercontent.com/u/1036236?v=4)](https://github.com/natxet "natxet (20 commits)")

### Embed Badge

![Health badge](/badges/natxet-twig-po/health.svg)

```
[![Health](https://phpackages.com/badges/natxet-twig-po/health.svg)](https://phpackages.com/packages/natxet-twig-po)
```

###  Alternatives

[smmoosavi/php-gettext

Wrapper for php-gettext by danilo segan. This library provides PHP functions to read MO files even when gettext is not compiled in or when appropriate locale is not present on the system.

1927.0k1](/packages/smmoosavi-php-gettext)[saeven/circlical-po-editor

Gettext \*.PO file editor and parser for PHP.

118.1k1](/packages/saeven-circlical-po-editor)

PHPackages © 2026

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