2017 © Pedro Peláez
 

library po-parser

Gettext *.po parser for PHP

image

maxakawizard/po-parser

Gettext *.po parser for PHP

  • Tuesday, May 10, 2016
  • by MAXakaWIZARD
  • Repository
  • 1 Watchers
  • 9 Stars
  • 19,655 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 9 Versions
  • 10 % Grown

The README.md

PoParser

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

GitHub tag Packagist Packagist, (*2)

Minimum PHP Version License, (*3)

Gettext *.po files parser for PHP., (*4)

This package is compliant with PSR-4 autoloading standard and PSR-12 coding standard. If you notice compliance oversights, please send a patch via pull request., (*5)

Usage

Read file content

$parser = new PoParser\Parser();
$parser->read('my-pofile.po');
$entries = $parser->getEntriesAsArrays();
// Now $entries contains every string information in your pofile

echo '

    '; foreach ($entries as $entry) { echo '
  • '. 'msgid: '.$entry['msgid'].'
    '. // Message ID 'msgstr: '.$entry['msgstr'].'
    '. // Translation 'reference: '.$entry['reference'].'
    '. // Reference 'msgctxt: ' . $entry['msgctxt'].'
    '. // Message Context 'tcomment: ' . $entry['tcomment'].'
    '. // Translator comment 'ccomment: ' . $entry['ccomment'].'
    '. // Code Comment 'obsolete?: '.(string)$entry['obsolete'].'
    '. // Is obsolete? 'fuzzy?: ' .(string)$entry['fuzzy']. // Is fuzzy? '
  • '; } echo '
';

Modify content

$parser = new PoParser\Parser();
$parser->read('my-pofile.po');
// Entries are stored in array, so you can modify them.

// Use updateEntry method to change messages you want.
$parser->updateEntry('Write your email', 'Escribe tu email');
$parser->write('my-pofile.po');

Todo

  • Improve entries edit interface
  • Ability to change any entry fields
  • Discover what's the meaning of "#@ " line
  • Fix multiline msgstr processing (for singular and plural entries)
  • Implement previous untranslated strings support

License

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

The Versions

10/05 2016

dev-master

9999999-dev http://github.com/MAXakaWIZARD/PoParser

Gettext *.po parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

i18n gettext l10n po

11/11 2015

1.2.1

1.2.1.0 http://github.com/MAXakaWIZARD/PoParser

Gettext *.po parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

i18n gettext l10n po

20/04 2015

1.2.0

1.2.0.0 http://github.com/MAXakaWIZARD/PoParser

Gettext *.po parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

i18n gettext l10n po

14/04 2015

1.1.1

1.1.1.0 http://github.com/MAXakaWIZARD/PoParser

Gettext *.po parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

i18n gettext l10n po

10/04 2015

1.1.0

1.1.0.0 http://github.com/MAXakaWIZARD/PoParser

Gettext *.po parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

i18n gettext l10n po

13/08 2014

1.0.3

1.0.3.0 http://github.com/MAXakaWIZARD/PoParser

Gettext *.po parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

i18n gettext l10n po

07/08 2014

1.0.2

1.0.2.0 http://github.com/MAXakaWIZARD/PoParser

Gettext *.po parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

i18n gettext l10n po

08/08 2013

1.0.1

1.0.1.0 http://github.com/MAXakaWIZARD/PoParser

Gettext parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

i18n gettext l10n po

04/03 2013

1.0

1.0.0.0 http://github.com/MAXakaWIZARD/PoParser

Gettext parser for PHP

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

i18n gettext l10n po