misieksnk / pomanager
PO files manager
1.0.4
2016-06-20 08:08 UTC
Requires
- misieksnk/msgfmt: *
- sepia/po-parser: ^4.2
This package is not auto-updated.
Last update: 2024-11-19 21:21:20 UTC
README
PO files manager
Installation
Simply use Composer:
$ composer require misieksnk/pomanager
Usage
use MisiekSnk\PoManager\PoManager;
Open .po file
$poManager = new PoManager('filename.po');
Get all translations array from .po file
$poManager->getTranslationsArray(); //[ // 'msgid_1' => 'msgstr 1', // 'msgid_2' => 'msgstr 2', // ... //]
Get translation by msgid
$translation = $poManager->getTranslation('msgid_1'); // 'msgstr 1'
Change translation for msgid
$msgid = 'msgid_2'; $msgstr = 'translated msgid 2'; $poManager->setTranslation($msgid, $msgstr);
Update .mo file with current .po content
$poManager->updateMo();
ToDo
- Batch updates