PHPackages                             opencat/filter-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. opencat/filter-po

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

opencat/filter-po
=================

GNU gettext PO file filter for the OpenCAT Framework

00PHP

Since May 9Pushed 1mo agoCompare

[ Source](https://github.com/shaikhammar/opencat-filter-po)[ Packagist](https://packagist.org/packages/opencat/filter-po)[ RSS](/packages/opencat-filter-po/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

catframework/filter-po
======================

[](#catframeworkfilter-po)

GNU gettext PO file filter for the [CAT Framework](https://github.com/shaikhammar/cat-framework).

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

[](#installation)

```
composer require catframework/filter-po
```

Usage
-----

[](#usage)

```
use CatFramework\FilterPo\PoFilter;

$filter = new PoFilter();

// Extract translatable segments from a PO file
$document = $filter->extract('messages.po', 'en', 'fr');

foreach ($document->getSegmentPairs() as $pair) {
    echo $pair->source->getPlainText() . PHP_EOL;
    // … send to MT, TM lookup, or human translator …
    $pair->target = new Segment('seg-t', [$translatedText]);
}

// Write the translated PO file
$filter->rebuild($document, 'messages.fr.po');
```

What gets extracted
-------------------

[](#what-gets-extracted)

Entry typeBehaviourNormal `msgid` / `msgstr`Extracted as a segmentHeader (empty `msgid`)Skipped — preserved verbatim in output`#, fuzzy` entriesSkipped — preserved verbatim in outputPlural forms (`msgid_plural`)Singular `msgid` extracted; translation written to `msgstr[0]`; remaining plural slots (`msgstr[1..n]`) set to empty stringMulti-line stringsContinuation lines concatenated and decodedPO escape sequences (`\n`, `\t`, `\"`, `\\`) are decoded on extraction and re-encoded on rebuild.

Skeleton format
---------------

[](#skeleton-format)

The skeleton stored in `BilingualDocument::$skeleton` is:

```
[
    'lines'   => string[],  // full file split by "\n", msgstr blocks replaced by tokens
    'seg_map' => [          // segId => token string
        'seg-1' => '{{SEG:001}}',
        'seg-2' => '{{SEG:002}}',
        // …
    ],
]
```

Limitations
-----------

[](#limitations)

- Plural translations: only `msgstr[0]` is filled; `msgstr[1..n]` require manual post-editing.
- `msgctxt` (message context) is recognised and skipped over during parsing but not exposed as metadata on the segment.
- Binary PO files (`.mo`) are not supported.

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance61

Regular maintenance activity

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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://www.gravatar.com/avatar/c6b9044413071860fd6199e56c661a24f449797b77a1b130f0df7e98be8481f4?d=identicon)[shaikhammar](/maintainers/shaikhammar)

---

Top Contributors

[![actions-user](https://avatars.githubusercontent.com/u/65916846?v=4)](https://github.com/actions-user "actions-user (3 commits)")

### Embed Badge

![Health badge](/badges/opencat-filter-po/health.svg)

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

###  Alternatives

[php-translation/translator

Translator services

25224.8k5](/packages/php-translation-translator)[longman/laravel-multilang

Package to integrate multi language (multi locale) functionality in Laravel 5.x

5514.5k1](/packages/longman-laravel-multilang)[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.

1926.6k1](/packages/smmoosavi-php-gettext)[amendozaaguiar/laraveles-spanish-for-jetstream

Archivos de traducción al español latinoamericano para Laravel con Jetstream (auth, pagination, passwords, validation + todas las cadenas de Jetstream).

1512.6k](/packages/amendozaaguiar-laraveles-spanish-for-jetstream)[laradevs/spanish

labels translated to spanish

166.7k](/packages/laradevs-spanish)

PHPackages © 2026

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