PHP code example of misieksnk / pomanager

1. Go to this page and download the library: Download misieksnk/pomanager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

misieksnk / pomanager example snippets


use MisiekSnk\PoManager\PoManager;

$poManager = new PoManager('filename.po');

$poManager->getTranslationsArray();
//[
//    'msgid_1' => 'msgstr 1',
//    'msgid_2' => 'msgstr 2',
//    ...
//]

$translation = $poManager->getTranslation('msgid_1'); // 'msgstr 1'

$msgid = 'msgid_2';
$msgstr = 'translated msgid 2';
$poManager->setTranslation($msgid, $msgstr);

$poManager->updateMo();