civicrm / strings
CiviCRM 字符串提取器
dev-master
2024-02-09 16:05 UTC
Requires
- nikic/php-parser: ~4.13.2
- symfony/console: ~2.3
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2024-09-09 17:33:14 UTC
README
civistrings 是 CiviCRM 核心和 CiviCRM 扩展的字符串提取器。它扫描 PHP、Smarty、JS 和部分 HTML 文件中对 ts() 函数的引用,并使用 gettext 的 POT 文件格式生成字符串列表。
要求
- PHP 7.4+
- Composer (https://getcomposer.org.cn)
下载:单个可执行文件(PHAR)
civistrings
以 PHAR 格式分发,这是一种便携式可执行文件(适用于 PHP)。它应该可以在已安装 PHP 5.3+ 的大多数类 Unix 系统上运行。
只需下载 civistrings
并将其放置在 PATH 中,例如
sudo curl -LsS https://download.civicrm.org/civistrings/civistrings.phar -o /usr/local/bin/civistrings sudo chmod +x /usr/local/bin/civistrings
要升级现有安装,重新下载最新的 civistrings.phar
。
下载:Git + Composer
要下载源代码树和所有依赖项,请使用 git
和 composer
,例如
git clone git://github.com/civicrm/civistrings.git
cd civistrings
composer install
主可执行文件是 bin/civistrings
。您可以直接执行该文件,或将 bin/
文件夹添加到 PATH
,例如
export PATH=/home/myuser/civistrings/bin:$PATH
使用方法
## Scan all recognizable files under "myfolder/" civistrings -o myfile.pot myfolder ## Scan all *.js files find -name '*.js' | civistrings - -o myfile.pot
开发和测试
"examples" 文件夹包含一系列示例输入文件和预期输出文件。要查看示例是否正确处理,只需运行 phpunit
。
如果您需要添加新的示例或更改测试行为,请更新 tests/Command/ExtractCommandTest.php
。
构建
要从源代码构建新的 civistrings.phar
复制,请安装 git
、composer
和 box
并运行
git clone git://github.com/civicrm/civistrings.git
cd civistrings
composer install
php -dphar.readonly=0 `which box` build