Robo tasks to manage gettext

v3.0.2 2018-09-19 11:37 UTC

This package is auto-updated.

Last update: 2024-04-20 00:28:09 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