定制 php-translation/extractor 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

php-translation/extractor

最新稳定版本:2.2.2

Composer 安装命令:

composer require php-translation/extractor

包简介

Extract translations form the source code

README 文档

README

Latest Version Total Downloads

Extract translation messages from source code

Install

Via Composer:

$ composer require php-translation/extractor

Usage

$extractor = new Extractor();

// Create an extractor for PHP files
$fileExtractor = new PHPFileExtractor();

// Add visitors
$fileExtractor->addVisitor(new ContainerAwareTrans());
$fileExtractor->addVisitor(new ContainerAwareTransChoice());
$fileExtractor->addVisitor(new FlashMessage());
$fileExtractor->addVisitor(new FormTypeChoices());

// Add the file extractor to Extactor
$extractor->addFileExtractor($fileExtractor);

// Define where the source code is
$finder = new Finder();
$finder->in('/foo/bar');

//Start extracting files
$sourceCollection = $extractor->extract($finder);

Found an issue?

Is it something we do not extract? Please add it as a test. Add a new file with your example code in tests/Resources/Github/Issue_XX.php, then edit the AllExtractorsTest to make sure the translation key is found:

// ...
$this->translationExists($sc, 'trans.issue_xx');

统计信息

  • 总下载量: 4.31M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 128
  • 点击次数: 1
  • 依赖项目数: 7
  • 推荐数: 0

GitHub 信息

  • Stars: 128
  • Watchers: 7
  • Forks: 33
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04