2017 © Pedro Peláez
 

library gettext-parser

Gettext parser for source code

image

maxakawizard/gettext-parser

Gettext parser for source code

  • Tuesday, May 10, 2016
  • by MAXakaWIZARD
  • Repository
  • 1 Watchers
  • 5 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

Source code parser for Poedit

Build Status Scrutinizer Code Quality Code Climate SensioLabs Insight Coverage Status, (*1)

Github Releases GitHub tag Minimum PHP Version License, (*2)

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., (*3)

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

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:, (*5)

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

Smarty

block.t plugin:, (*6)

{t}Text to be localized{/t}

native:, (*7)

{"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., (*8)

Tests

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

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

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

License

This library is released under MIT license., (*11)

The Versions

10/05 2016

dev-master

9999999-dev https://github.com/MAXakaWIZARD/GettextParser

Gettext parser for source code

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

17/04 2015

1.2.0

1.2.0.0 https://github.com/MAXakaWIZARD/GettextParser

Gettext parser for Windows

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

14/04 2015

1.1.0

1.1.0.0 https://github.com/MAXakaWIZARD/GettextParser

Gettext parser for Windows

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

12/03 2015

1.0.3

1.0.3.0 https://github.com/MAXakaWIZARD/GettextParser

Gettext parser for Windows

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

12/03 2015

1.0.2

1.0.2.0 https://github.com/MAXakaWIZARD/GettextParser

Gettext parser for Windows

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

22/09 2013

1.0.1

1.0.1.0 https://github.com/MAXakaWIZARD/GettextParser

Gettext parser for Windows

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

22/09 2013

1.0.0

1.0.0.0 https://github.com/MAXakaWIZARD/GettextParser

Gettext parser for Windows

  Sources   Download

MIT

The Requires

  • php >=5.3.0