PHP code example of brazvo / gettext-php-scanner

1. Go to this page and download the library: Download brazvo/gettext-php-scanner 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/ */

    

brazvo / gettext-php-scanner example snippets




$gettext = new \PhpScanner\Gettext();

$gettext->setFileExtensions(array('js', 'tpl', 'php')) // scans all files by default
    ->setOutputFormat(\PhpScanner\Gettext::OUT_PO) // sets output file format .po | .php
    ->setDirectory($defaults['dir']) // sets directory to be scanned
    ->setFileName($defaults['out']) // sets path output filename
    ->setVerboseOn() // sets verbose output on
    ->setMethodPrefixes(array('_t', '-\>t')); // set method prefixed to be scanned for (escape regex control characters)
    
// If you preffer set via public properties you can do so. See bellow.

$lines = $gettext->generate();