PHP code example of kunststube / potools

1. Go to this page and download the library: Download kunststube/potools 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/ */

    

kunststube / potools example snippets


// Extraction of strings from source is not part of Kunststube\POTools,
// bring your own extractor specific to your needs.
$extractedStrings = my_string_extractor('template.php');

$catalog = new Kunststube\POTools\Catalog('My Project 1.0', 'en_US');

foreach ($extractedStrings as $extractedString) {
    $POString = new Kunststube\POTools\POString($extractedString);

    // set as many additional attributes as you can extract
    $POString->setDomain('errors');
    ...

    $catalog->add($POString);
}
    
$catalog->writeToDirectory('locale/en_US');