PHPackages                             smarty-gettext/tsmarty2c - 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. smarty-gettext/tsmarty2c

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

smarty-gettext/tsmarty2c
========================

Smarty Gettext Translation String Ripper

0.2.2(4y ago)36588[3 issues](https://github.com/smarty-gettext/tsmarty2c/issues)[1 PRs](https://github.com/smarty-gettext/tsmarty2c/pulls)BSD-3-ClausePHPPHP ^5.5.9 || ^7.0CI failing

Since Sep 10Pushed 4y ago2 watchersCompare

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

READMEChangelog (5)Dependencies (7)Versions (8)Used By (0)

tsmarty2c.php - the command line utility
========================================

[](#tsmarty2cphp---the-command-line-utility)

`tsmarty2c.php` - A command line utility that rips gettext strings from smarty source files and converts them to `.pot` (PO-Template).

This utility will scan templates for `{t}...{/t}` placeholders for translation strings and output a `.pot` file (`.po` template).

Usage:

```
./vendor/bin/tsmarty2c.php -o template.pot

```

If a parameter is a directory, the template files within will be parsed, recursively.

In output special PO tags are added that inform about location of extracted translation. Most of the PO edit tools can respect that information.

If you wish to scan also `.php` or `.phtml` files for native gettext calls, you may wish to combine result of `tsmarty2c` and `xgettext` calls:

```
./vendor/bin/tsmarty2c.php -o smarty.pot ...
xgettext --add-comments=TRANSLATORS: --keyword=gettext --keyword=_  --output=code.pot ...
msgcat -o template.pot code.pot smarty.pot
rm -f code.pot smarty.pot

```

By default `tsmarty2c` scans for `.tpl` files, if you wish to use other files, you can use `xargs` in unix:

```
find templates -name '*.tpl.html' -o -name '*.tpl.text' -o -name '*.tpl.js' -o -name '*.tpl.xml' | xargs tsmarty2c.php -o smarty.pot

```

See how it's done in [Eventum](https://github.com/eventum/eventum/blob/master/localization/Makefile) project.

Installing
----------

[](#installing)

1. as package depdencency:

    ```
    composer require --dev smarty-gettext/tsmarty2c
    ./vendor/bin/tsmarty2c.php

    ```
2. directly from this repository

    ```
    git clone https://github.com/smarty-gettext/tsmarty2c
    cd tsmarty2c
    composer install --no-dev
    ./bin/tsmarty2c.php

    ```

Developing
----------

[](#developing)

1. clone this repository
2. [get composer](https://getcomposer.org/download/)
3. install composer dependencies: `php composer.phar install`
4. start using it: `php bin/tsmarty2c.php`

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 96.6% 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 ~313 days

Recently: every ~391 days

Total

6

Last Release

1604d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/32449?v=4)[Glen Noronha](/maintainers/glen)[@glen](https://github.com/glen)

---

Top Contributors

[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (84 commits)")[![kumy](https://avatars.githubusercontent.com/u/176794?v=4)](https://github.com/kumy "kumy (3 commits)")

---

Tags

gettextsmartytsmarty2cxgettext

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/smarty-gettext-tsmarty2c/health.svg)

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

###  Alternatives

[barryvdh/laravel-translation-manager

Manage Laravel Translations

1.7k3.6M17](/packages/barryvdh-laravel-translation-manager)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[php-translation/symfony-bundle

3244.1M9](/packages/php-translation-symfony-bundle)[kkomelin/laravel-translatable-string-exporter

Translatable String Exporter for Laravel

3291.4M10](/packages/kkomelin-laravel-translatable-string-exporter)[vemcogroup/laravel-translation

Translation package for Laravel to scan for localisations and up/download to poeditor

135304.0k2](/packages/vemcogroup-laravel-translation)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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