public function generate($target, $options)
    {
        if ($options['source']) {
            $this->sourcePath = $options['source'];
        }

        $messages = $this->getMessages();
        $this->prepareTarget($target);

        if ($options['no-lib']) {
            $template = $this->file->get(__DIR__.'/Templates/messages.js');
        } else if ($options['json']) {
            $template = $this->file->get(__DIR__.'/Templates/messages.json');
        } else {
            $template = $this->file->get(__DIR__.'/Templates/langjs_with_messages.js');
            $langjs = $this->file->get(__DIR__.'/../../../../lib/lang.min.js');
            $template = str_replace('\'{ langjs }\';', $langjs, $template);
        }

        $template = str_replace('\'{ messages }\'', json_encode($messages), $template);

        if ($options['compress']) {
            $template = Minifier::minify($template);
        }

        return $this->file->put($target, $template);
    }
public function generate($target, $options)
    {
        if ($options['source']) {
            $this->sourcePath = $options['source'];
        }

        $messages = $this->getMessages();
        $this->prepareTarget($target);

        if ($options['no-lib']) {
            $template = $this->file->get(__DIR__.'/Templates/messages.js');
        } else if ($options['json']) {
            $template = $this->file->get(__DIR__.'/Templates/messages.json');
        } else {
            $template = $this->file->get(__DIR__.'/Templates/langjs_with_messages.js');
            $langjs = $this->file->get(__DIR__.'/../../../../lib/lang.min.js');
            $template = str_replace('\'{ langjs }\';', $langjs, $template);
        }

        $template = str_replace('\'{ messages }\'', json_encode($messages), $template);

        if ($options['compress']) {
            $template = Minifier::minify($template);
        }

        return $this->file->put($target, $template);
    }
public function generate ( $ target , $ options ) { if ( $ options [ 'source' ] ) { $ this -> sourcePath = $ options [ 'source' ] ; } $ messages = $ this -> getMessages ( ) ; $ this -> prepareTarget ( $ target ) ; if ( $ options [ 'no-lib' ] ) { $ template = $ this -> file -> get ( __DIR__ . '/Templates/messages.js' ) ; } else if ( $ options [ 'json' ] ) { $ template = $ this -> file -> get ( __DIR__ . '/Templates/messages.json' ) ; } else { $ template = $ this -> file -> get ( __DIR__ . '/Templates/langjs_with_messages.js' ) ; $ langjs = $ this -> file -> get ( __DIR__ . '/../../../../lib/lang.min.js' ) ; $ template = str_replace ( '\'{ langjs }\';' , $ langjs , $ template ) ; } $ template = str_replace ( '\'{ messages }\'' , json_encode ( $ messages ) , $ template ) ; if ( $ options [ 'compress' ] ) { $ template = Minifier :: minify ( $ template ) ; } return $ this -> file -> put ( $ target , $ template ) ; }
Generate a JS lang file from all language files.

@param string $target  The target directory.
@param array  $options Array of options.

@return int
Generate a JS lang file from all language files .