kgaut/potx 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kgaut/potx

Composer 安装命令:

composer require kgaut/potx

包简介

Translation template extractor port for Drupal 8

README 文档

README

NOTE from @kgaut :

This is a quick and dirty port for d8, this readme file is not accurate. @see : https://www.drupal.org/node/2356469

How to make it works ?

  • download this module in modules folder (if you use composer : composer require kgaut/potx)
  • enable it : drush en potx
  • extract translation with drush : drush @ALIAS potx single --include=modules/contrib/potx/ --modules=MYMODULE_MACHINE_NAME --api=8

Thanks to @rodrigoaguilera you can now export tranlated string from the database : drush @ALIAS potx single --modules=MYMODULE_MACHINE_NAME --api=8 --language=es

ABOUT

The goal of the Translation Template Extractor project is to provide command line and web based Gettext translation template extractor functionality for Drupal. These translation templates are used by teams to translate Drupal to their language of choice. There are basically two ways to use the contents of this project:

  • Copy potx.inc and potx-cli.php to the directory you would like to generate translation templates for and run php potx-cli.php. The translation templates will get generated in the current directory.

  • Install the module on a Drupal site as you would with any other module. Once potx module is turned on, you can go to the "Extract" tab on the "Translate interface" administration interface, select the module or modules or theme or themes you want to have a translation template for, and submit the form. You will get one single template file generated.

    Note: If you only get a white browser screen as response to the extraction request, the memory limit for PHP on the server is probably too low, try to set that higher.

The module also includes optional Coder (http://drupal.org/project/coder) integration, allowing you to spot translatability errors in modules while doing your regular code review.

USING potx-cli.php ON THE COMMAND LINE

Translation templates can easily be created by running the potx-cli.php script on all source files that contain translatable strings.

  1. Copy the potx-cli.php and potx.inc to whatever folder you would like to generate template files in.
  2. Run 'php potx-cli.php' and the script will autodiscover all possible files to generate templates for.
  3. Translation templates are generated in this folder, if you have the proper rights to create files here.

You can try 'php potx-cli.php --help' to get a list of more options.

The contents of files depend on the mode you use. By default, one single general.pot file will be generated. You can use the "core" mode to generate Drupal core templates (one file per directory, repeated usage of the same string in multiple directories folded into general.pot, .info files folded into general.pot). Or you can use the "multiple" mode which is similar to the "core" mode, but .info files are folded into their module template files.

In case of "core" and "multiple" mode, the generated general.pot will contain strings that occur more than once in the source files. This will help translators to maintain a single translation for them.

CREDITS

Command line extractor functionality orignally by Jacobo Tarrio <jtarrio [at] alfa21.com> (2003, 2004 Alfa21 Outsourcing)

Greatly optimized by Brandon Bergren (2007)

Currently maintained by Gabor Hojtsy <gabor [at] hojtsy.hu>

kgaut/potx 适用场景与选型建议

kgaut/potx 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 586.22k 次下载、GitHub Stars 达 16, 最近一次更新时间为 2026 年 01 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「l10n」 「drupal」 「drupal8」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 kgaut/potx 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 kgaut/potx 我们能提供哪些服务?
定制开发 / 二次开发

基于 kgaut/potx 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 586.22k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 16
  • 点击次数: 38
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 16
  • Watchers: 1
  • Forks: 10
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-01-04