Download the PHP package galette/smarty-xgettext without Composer
On this page you can find all versions of the php package galette/smarty-xgettext. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download galette/smarty-xgettext
More information about galette/smarty-xgettext
Files in galette/smarty-xgettext
Package smarty-xgettext
Short Description Smarty xgettext features
License BSD-3-Clause
Homepage https://github.com/galette/smarty-xgettext
Informations about the package smarty-xgettext
Smarty xgettext
A command line utility to extract translations source strings from Smarty templates to a PO-Template (.pot
) file.
This utility will scan templates for {_T string=""}
placeholders for translation strings and output a .pot
file (.po
template).
Features:
- scan files and directories recursively,
- include original string location,
- supports plurals
{_T string="singular" plural="plural"}
, - supports contexts
{_T string="string" context="mycontext"}
, - supports comments
{_T string="string" comment="Explanation"}
- supports domains
{_T string="string" domain="mydomain""}
,{_T string="singular" plural="plural" domain="mydomain}
, ...
Usage:
./vendor/bin/smarty-xgettext -o smarty.pot <filename or directory> <file2> <...>
find templates -name '*.tpl.html' -o -name '*.tpl.text' -o -name '*.tpl.js' -o -name '*.tpl.xml' | xargs ./vendor/bin/smarty-xgettext -o smarty.pot
If a parameter is a directory, the template files within will be parsed, recursively.
If you want to combine Smarty translations with your PHP ones, you can combine results with the msgcat
command:
Developing
- clone this repository
- get composer
- install composer dependencies:
php composer.phar install
- start using it:
php bin/smarty-xgettext
Initially based on tsmatry2c. Original project (which seems not maintained) was using Smarty blocks while Galette relies on a function.
All versions of smarty-xgettext with dependencies
php Version ^7.3 || ^8
smarty/smarty Version ^3.1
symfony/console Version ^5.1
symfony/finder Version ^5.1