PHPackages                             saeven/zf2-poeditor - 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. [Templating &amp; Views](/categories/templating)
4. /
5. saeven/zf2-poeditor

ActiveLibrary[Templating &amp; Views](/categories/templating)

saeven/zf2-poeditor
===================

Front end to gettext that lets you translate your PHP and Twig files in a snap

0.9(10y ago)32.0kMITPHPPHP &gt;=5.5

Since Feb 11Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Saeven/zf2-poeditor)[ Packagist](https://packagist.org/packages/saeven/zf2-poeditor)[ Docs](https://github.com/Saeven/zf2-poeditor)[ RSS](/packages/saeven-zf2-poeditor/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

Zend Framework 2 Gettext File Editor
====================================

[](#zend-framework-2-gettext-file-editor)

Want a PHP/Twig file parser that's local to your project, with a web GUI to deal with gettext intricacies? This project is it!

How it works
------------

[](#how-it-works)

This project combines a parser, an PHP PO file editor, and gettext CLI commands to do what programs like PoEdit do at the surface. You use translation markers in your code like:

```
// php code
_( "this string will automatically get picked up by gettext");
$sm->get('translator')->translate( "So will this one" );
$el->setLabel( "This one too");
```

```
// twig code
{% trans %}This is a singular translation{% endtrans %}
{% trans "This is also a singular translation" %}

{% set apples = 3 %}
{% trans %}
There is one apple in the cart.
{% plural apples %}
There are {{ apples }} in the cart.
{% endtrans %}
```

Then, when you use the web GUI you'll see a set of fields where you can edit all of your translatable-text.

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

[](#installation)

To install the packages:

```
composer require saeven/zf2-poeditor

```

Then add these modules to your ZF2 application config:

```
CirclicalTranslationEditor

```

Access /translate to confirm that it's set up. If you don't have a Twig/Trans bridge in there already, you can also load

```
CirclicalTwigTrans

```

To gain {% trans %} for Twig

You have to make sure that you have gettext installed as well. Check your system with these commands:

```
which msgfmt
which gettext
which xgettext
which msguniq

```

If they all exist, you are in business. Otherwise, Google how to get gettext binaries installed on your system.

Configuration
-------------

[](#configuration)

Once you have downloaded the Composer package, copy the autoload config to your project:

```
cp ./vendor/saeven/zf2-poeditor/config/autoload/circlical.translator.local.php ./config/autoload

```

In that file, you'll see these config keys:

Key NameDescriptionxgettextFull path to your xgettext executable.msgcatFull path to your msgcat executable.msgfmtFull path to your msgfmt executable.backup\_dirThe folder where .po files are backed up with each pass. **must be writable**cache\_dirThe cache folder where the temporary .pot files are stored during compilation. **must be writable**stub\_functions*See 'Stubs' below*stub\_filters*See 'Stubs' below*### Stubs

[](#stubs)

If you are coming from the camp that combines PoEdit with a Twig extractor, you'll remember those instances where you'd get a giant error message but no reason why. 90% of the time, it's because a developer had added a custom filter or helper that wasn't registered with the extractor. The outcome is breakage: the extractor dies, PoEdit can't ferry the error, and you're stuck cutting and pasting messages to identify the culprit.

Enter stubs.

When you are using this package, the Twig errors will be reported in plain sight if you meet this circumstance.

!\[Error Sample\] ()

In that image, you can see that the **GrilledCheese** helper is not registered (what a shame, so tasty). Somewhere in the Twig files, there's a `{{ GrilledCheese }}` that's causing the problem. To fix this:

- Open up the translator config
- Add 'GrilledCheese' to the function stubs
- Save the config
- Click refresh inside the translator

Filters work similarly, the error message will guide you properly.

Some Instructions!
------------------

[](#some-instructions)

#### Locale Discovery

[](#locale-discovery)

**Locale discovery** depends on the proper set up of gettext message folders within your modules. These would like like:

> module/Application/language/en\_US/LC\_MESSAGES module/Application/language/fr\_CA/LC\_MESSAGES

You'll have to set these up or there'll be no locales in the dropdown within the translator.

#### Scan Mode

[](#scan-mode)

The system scans your module folders only, for PHP and Twig files.

#### Compile Trigger

[](#compile-trigger)

The pot files are compiled when you select a locale.

#### Configuration Required!

[](#configuration-required)

If you don't configure the languages that you work on, then you won't get the right PO headers in place. If this happens, then compilation from po to mo is not possible. Be sure to configure your file with the language team, charset, and plural form for your language.

#### Sanity Check

[](#sanity-check)

You can check your ./data/cache/translator folder for these files while you're working. Their presence lets you know things should be working:

- \*.php.pot
- \*.pot
- translator.ini

Contributing
------------

[](#contributing)

This is a first release, but it works very well. It's my hope to PSR-7 this with Expressive so that all frameworks can benefit from its use. Throwing out to the world can only make it better! Have an idea or an issue you can solve? PR it up, let's make this tool a solid alternative to PoEdit together!

Thanks in advance!

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

3792d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/887224?v=4)[Alexandre Lemaire](/maintainers/Saeven)[@Saeven](https://github.com/Saeven)

---

Top Contributors

[![Saeven](https://avatars.githubusercontent.com/u/887224?v=4)](https://github.com/Saeven "Saeven (30 commits)")

---

Tags

phptwiggettextpoedit

### Embed Badge

![Health badge](/badges/saeven-zf2-poeditor/health.svg)

```
[![Health](https://phpackages.com/badges/saeven-zf2-poeditor/health.svg)](https://phpackages.com/packages/saeven-zf2-poeditor)
```

###  Alternatives

[goetas/twital

PHP templating engine that combines Twig and PHPTal power points

12813.1k1](/packages/goetas-twital)[picocms/pico-composer

Pico is a flat file CMS, this means there is no administration backend and database to deal with. You simply create .md files in the "content" folder and that becomes a page.

1920.7k](/packages/picocms-pico-composer)[goetas/twital-bundle

Twital templating engine Symfony Bundle

206.8k](/packages/goetas-twital-bundle)

PHPackages © 2026

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