maxakawizard/gettext-parser 问题修复 & 功能扩展

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

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

maxakawizard/gettext-parser

最新稳定版本:1.2.0

Composer 安装命令:

composer require maxakawizard/gettext-parser

包简介

Gettext parser for source code

README 文档

README

Build Status Scrutinizer Code Quality Code Climate SensioLabs Insight Coverage Status

Github Releases GitHub tag Minimum PHP Version License

Library for syncing gettext catalogs with Smarty and Javascript sources. Poedit already has parser for *.php files out of the box. Library parses files and writes results as php files, whose are processed by Poedit PHP parser.

This package is compliant with PSR-4, PSR-1, and PSR-2. If you notice compliance oversights, please send a patch via pull request.

Installation

  • Download sources and unpack to any folder.
  • If needed, create config.php file (see config.php.dist) and specify path to xgettext binary

Supported formats

JavaScript

jQuery.gettext plugin:

_('Text to be localized')
n_('country', 'countries', 3);

Smarty

block.t plugin:

{t}Text to be localized{/t}

native:

{"Text to be localized"|_}
{_("Text to be localized")}

Usage

  1. Create new parser in Poedit: File->Preferences->Parsers->New
  2. Update your gettext catalog: Catalogue->Update from sources

Parser params:

Smarty

  • Language: Smarty
  • Parser command: php.exe -f "/path/to/GettextParser/index.php" Smarty %o %C %K %F
  • List of extensions: *.tpl
  • An item in keywords list: -k%k
  • An item in input files list: %f
  • Source code charset: --from-code=%c

JavaScript

  • Language: JavaScript
  • Parser command: php.exe -f "/path/to/GettextParser/index.php" JavaScript %o %C %K %F
  • List of extensions: *.js
  • An item in keywords list: -k%k
  • An item in input files list: %f
  • Source code charset: --from-code=%c

Known issues

  • plurals are not supported for Smarty (planned)

Contributing

Contribution is highly encouraged! Just send your pull-requests or create issues.

Tests

Library is covered with unit tests. For running those tests you'll need PHPUnit. It's recommended to use phpunit.phar.

Just specify tests/phpunit.xml.dist as config file for PHPUnit (actually it can found it automatically):

php phpunit.phar -c tests/phpunit.xml.dist

License

This library is released under MIT license.

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固