PHP code example of gettext / robo

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

    

gettext / robo example snippets




use Robo\Tasks;

class RoboFile extends Robo\Tasks
{
    use Gettext\Robo\Gettext;

    /**
     * Scan files to find new gettext values
     */
    public function gettext()
    {
        $this->taskGettext()
            //Scan folders with php files
            ->scan('templates/', '/\.php$/')
            ->scan('other-files/', '/\.php$/')

            //Save the domain1
            ->save('domain1', 'Locale/es/LC_MESSAGES/domain1.po')
            ->save('domain1', 'Locale/gl/LC_MESSAGES/domain1.po')

            //Save the domain2
            ->save('domain2', 'Locale/es/LC_MESSAGES/domain1.po')
            ->save('domain2', 'Locale/gl/LC_MESSAGES/domain1.po')

            ->run();
    }
}