PHPackages                             maxakawizard/gettext-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. maxakawizard/gettext-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

maxakawizard/gettext-parser
===========================

Gettext parser for source code

1.2.0(11y ago)5255[1 PRs](https://github.com/MAXakaWIZARD/GettextParser/pulls)MITPHPPHP &gt;=5.3.0

Since Sep 22Pushed 10y ago1 watchersCompare

[ Source](https://github.com/MAXakaWIZARD/GettextParser)[ Packagist](https://packagist.org/packages/maxakawizard/gettext-parser)[ Docs](https://github.com/MAXakaWIZARD/GettextParser)[ RSS](/packages/maxakawizard-gettext-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (7)Used By (0)

Source code parser for Poedit
=============================

[](#source-code-parser-for-poedit)

[![Build Status](https://camo.githubusercontent.com/8a61a41f10ada2db01808a7a509863589ec44a489bf76186bd406029ecac066d/68747470733a2f2f6170692e7472617669732d63692e6f72672f4d4158616b6157495a4152442f476574746578745061727365722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/MAXakaWIZARD/GettextParser)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/357bc4d97aaf2b2314dc279c2199819888051eef8371b6267f4c4f6edc37e868/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4d4158616b6157495a4152442f476574746578745061727365722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/MAXakaWIZARD/GettextParser/?branch=master)[![Code Climate](https://camo.githubusercontent.com/a83618aaae528baa7c8b2ec122e51e81c33485584f4e6b1a3b285706c9350bf4/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f4d4158616b6157495a4152442f476574746578745061727365722f6261646765732f6770612e737667)](https://codeclimate.com/github/MAXakaWIZARD/GettextParser)[![SensioLabs Insight](https://camo.githubusercontent.com/5a113c9d6384e7cdf7de19200166976ab27043c2352258f5fe4b905b847c7979/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f36313530313739612d613836382d343032362d616564392d3766393531353962343766342e737667)](https://insight.sensiolabs.com/projects/6150179a-a868-4026-aed9-7f95159b47f4)[![Coverage Status](https://camo.githubusercontent.com/44d1c1cf3464f6b0a5a962d93a18904934219898112c84d9afbca1f7e8879d77/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f4d4158616b6157495a4152442f476574746578745061727365722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/r/MAXakaWIZARD/GettextParser?branch=master)

![Github Releases](https://camo.githubusercontent.com/f72a1e30fdbd65cdb86dcb317b061d685c0999039f34c79b92d5283522c78d5d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f4d4158616b6157495a4152442f476574746578745061727365722f6c61746573742f746f74616c2e737667)[![GitHub tag](https://camo.githubusercontent.com/16d7cca9967b401a81807e657d849cdf78d1204267b2506d852a437c2cf6a667/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f4d4158616b6157495a4152442f476574746578745061727365722e7376673f6c6162656c3d6c6174657374)](https://packagist.org/packages/maxakawizard/gettext-parser)[![Minimum PHP Version](https://camo.githubusercontent.com/15652a39c31b79c4255f80c0ff59e65c6242b52bfe8cab3b6362d3d18d0df831/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230352e332d3838393242462e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/a56720adf4507bc1374f1d397a77854d8d41f48854b2ef7c68ce27363589ec03/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6d6178616b6177697a6172642f676574746578742d7061727365722e737667)](https://packagist.org/packages/maxakawizard/gettext-parser)

Library for syncing gettext catalogs with Smarty and Javascript sources. `Poedit` already has parser for `*.php` files out of the box. Library parses files and writes results as `php` files, whose are processed by Poedit PHP parser.

This package is compliant with [PSR-4](http://www.php-fig.org/psr/4/), [PSR-1](http://www.php-fig.org/psr/1/), and [PSR-2](http://www.php-fig.org/psr/2/). If you notice compliance oversights, please send a patch via pull request.

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

[](#installation)

- Download sources and unpack to any folder.
- If needed, create `config.php` file (see `config.php.dist`) and specify path to `xgettext` binary

Supported formats
-----------------

[](#supported-formats)

### JavaScript

[](#javascript)

[jQuery.gettext](https://github.com/jakob-stoeck/jquery-gettext) plugin:

```
_('Text to be localized')
n_('country', 'countries', 3);
```

### Smarty

[](#smarty)

block.t plugin:

```
{t}Text to be localized{/t}

```

native:

```
{"Text to be localized"|_}
{_("Text to be localized")}

```

Usage
-----

[](#usage)

1. Create new parser in `Poedit`: `File->Preferences->Parsers->New`
2. Update your gettext catalog: `Catalogue->Update from sources`

### Parser params:

[](#parser-params)

#### Smarty

[](#smarty-1)

- Language: `Smarty`
- Parser command: `php.exe -f "/path/to/GettextParser/index.php" Smarty %o %C %K %F`
- List of extensions: `*.tpl`
- An item in keywords list: `-k%k`
- An item in input files list: `%f`
- Source code charset: `--from-code=%c`

#### JavaScript

[](#javascript-1)

- Language: `JavaScript`
- Parser command: `php.exe -f "/path/to/GettextParser/index.php" JavaScript %o %C %K %F`
- List of extensions: `*.js`
- An item in keywords list: `-k%k`
- An item in input files list: `%f`
- Source code charset: `--from-code=%c`

Known issues
------------

[](#known-issues)

- plurals are not supported for Smarty (planned)

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

[](#contributing)

Contribution is highly encouraged! Just send your pull-requests or create issues.

Tests
-----

[](#tests)

Library is covered with unit tests. For running those tests you'll need [PHPUnit](https://github.com/sebastianbergmann/phpunit/). It's recommended to use `phpunit.phar`.

Just specify `tests/phpunit.xml.dist` as config file for PHPUnit (actually it can found it automatically):

```
php phpunit.phar -c tests/phpunit.xml.dist
```

License
-------

[](#license)

This library is released under [MIT](http://www.tldrlegal.com/license/mit-license) license.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 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 ~114 days

Recently: every ~143 days

Total

6

Last Release

4049d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1138453?v=4)[Max Grigorian](/maintainers/MAXakaWIZARD)[@MAXakaWIZARD](https://github.com/MAXakaWIZARD)

---

Top Contributors

[![MAXakaWIZARD](https://avatars.githubusercontent.com/u/1138453?v=4)](https://github.com/MAXakaWIZARD "MAXakaWIZARD (64 commits)")

### Embed Badge

![Health badge](/badges/maxakawizard-gettext-parser/health.svg)

```
[![Health](https://phpackages.com/badges/maxakawizard-gettext-parser/health.svg)](https://phpackages.com/packages/maxakawizard-gettext-parser)
```

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[jms/metadata

Class/method/property metadata management in PHP

1.8k152.8M88](/packages/jms-metadata)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M627](/packages/jms-serializer-bundle)[hassankhan/config

Lightweight configuration file loader that supports PHP, INI, XML, JSON, and YAML files

97513.5M170](/packages/hassankhan-config)[meyfa/php-svg

Read, edit, write, and render SVG files with PHP

54613.9M42](/packages/meyfa-php-svg)

PHPackages © 2026

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