saeven/circlical-po-editor
最新稳定版本:0.9.1
Composer 安装命令:
composer require saeven/circlical-po-editor
包简介
Gettext *.PO file editor and parser for PHP.
README 文档
README
PHP Parser/Editor for Gettext PO files
PoEditor is a class that allows you to load / parse / manipulate / compile .po files using PHP. I built this to support a web-based PO file editor.
This repository is thoroughly tested, mosts tests were taken from raulferras/PHP-po-parser, thank you!
It supports all of the same features, with a simpler and stable interface:
- headers (HeaderBlock)
- msgid (message id)
- msgstr (translation strings)
- msgctxt (context)
- msgid_plural (plural translations)
-
(flags, comments, source, references, annotations, etc.)
When you parse a po file, it transforms it into blocks that you can cleanly manipulate to thereafter compile.
Usage
Parsing Files
$po = new Circlical\PoEditor( 'file.po' ); $po->parse();
Editing Blocks
$po = new Circlical\PoEditor( 'file.po' ); $po->parse(); $po->getBlock( 'welcome' )->setMsgstr( "hola" ); $po->compile();
That transforms file.po from:
#: wp-admin/install.php:177
msgid "welcome"
msgstr "welcome"
to:
#: wp-admin/install.php:177
msgid "welcome"
msgstr "hola"
统计信息
- 总下载量: 8.08k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-12-21