smarty-gettext/tsmarty2c
Composer 安装命令:
composer require smarty-gettext/tsmarty2c
包简介
Smarty Gettext Translation String Ripper
README 文档
README
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 <filename or directory> <file2> <...>
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 project.
Installing
-
as package depdencency:
composer require --dev smarty-gettext/tsmarty2c ./vendor/bin/tsmarty2c.php -
directly from this repository
git clone https://github.com/smarty-gettext/tsmarty2c cd tsmarty2c composer install --no-dev ./bin/tsmarty2c.php
Developing
- clone this repository
- get composer
- install composer dependencies:
php composer.phar install - start using it:
php bin/tsmarty2c.php
smarty-gettext/tsmarty2c 适用场景与选型建议
smarty-gettext/tsmarty2c 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 676 次下载、GitHub Stars 达 3, 最近一次更新时间为 2020 年 07 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 smarty-gettext/tsmarty2c 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 smarty-gettext/tsmarty2c 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 676
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 12
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-07-02