gettext/robo

Robo tasks to manage gettext

v3.0.1 2016-12-20 21:02 UTC

README

Robo task to extract gettext values from files using gettext/gettext library

Created by Oscar Otero http://oscarotero.com oom@oscarotero.com (MIT License)

Install

Using composer:

composer require gettext/robo

usage example

Create a RoboFile.php with the following code:

require 'vendor/autoload.php';

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

    /**
     * Scan files to find new gettext values
     */
    public function gettext()
    {
        $this->taskGettextScanner()
            ->extract('templates/')
            ->extract('js/', '/.*\.js/') //directory + regex
            ->generate('Locale/gl/LC_MESSAGES/messages.mo')
            ->generate('Locale/es/LC_MESSAGES/messages.mo')
            ->generate('Locale/en/LC_MESSAGES/messages.mo')
            ->run();
    }
}

Use robo to run the code:

robo gettext