1. Go to this page and download the library: Download maxakawizard/po-parser 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/ */
maxakawizard / po-parser example snippets
$parser = new PoParser\Parser();
$parser->read('my-pofile.po');
$entries = $parser->getEntriesAsArrays();
// Now $entries contains every string information in your pofile
echo '<ul>';
foreach ($entries as $entry) {
echo '<li>'.
'<b>msgid:</b> '.$entry['msgid'].'<br>'. // Message ID
'<b>msgstr:</b> '.$entry['msgstr'].'<br>'. // Translation
'<b>reference:</b> '.$entry['reference'].'<br>'. // Reference
'<b>msgctxt:</b> ' . $entry['msgctxt'].'<br>'. // Message Context
'<b>tcomment:</b> ' . $entry['tcomment'].'<br>'. // Translator comment
'<b>ccomment:</b> ' . $entry['ccomment'].'<br>'. // Code Comment
'<b>obsolete?:</b> '.(string)$entry['obsolete'].'<br>'. // Is obsolete?
'<b>fuzzy?:</b> ' .(string)$entry['fuzzy']. // Is fuzzy?
'</li>';
}
echo '</ul>';
$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');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.