voda/gettext-extractor

提取 gettext 消息的工具

v4.0.5 2021-10-11 21:38 UTC

This package is auto-updated.

Last update: 2024-08-25 15:10:34 UTC


README

提取 PHP 文件和 Latte 模板中的 gettext 短语的工具。输出以 .pot 文件生成。

Build Status Latest Stable Version Total Downloads License

安装

要安装 gettext-extractor,请使用 composer 安装: $ composer require --dev voda/gettext-extractor

或者您可以从 发布页面 下载独立的 PHAR 文件。

使用方法

./vendor/bin/gettext-extractor [选项]

Options:
  -h            display this help and exit
  -oFILE        output file, default output is stdout
  -lFILE        log file, default is stderr
  -fFILE        file to extract, can be specified several times
  -kFUNCTION    add FUNCTION to filters, format is:
                FILTER:FUNCTION_NAME:SINGULAR,PLURAL,CONTEXT
                default FILTERs are PHP and Latte
                for SINGULAR, PLURAL and CONTEXT '0' means not set
                can be specified several times
  -mKEY:VALUE   set meta header

例如: ./vendor/bin/gettext-extractor -o output/file.pot -f files/to/extract/

支持文件类型

  • .php
  • .latte (Nette Latte 模板)

许可证

GettextExtractor 在新 BSD 许可证下授权。

基于 Karel Klíma 的代码。