Localizer::Scanner::Xslate - Scanner for Text::Xslate style file
use Localizer::Dictionary; use Localizer::Scanner::Xslate; my $result = Localizer::Dictionary->new(); my $scanner = Localizer::Scanner::Xslate->new( syntax => 'TTerse', ); $scanner->scan_file($result, 'path/to/xslate.html');
Localizer::Scanner::Xslate is localization tag scanner for Xslate templates.
This module finds [% l("foo") %] style tags from xslate template files.
[% l("foo") %]
Localizer::Scanner::Xslate(%args | \%args)
Constructor. It makes scanner instance.
e.g.
my $ext = Localizer::Scanner::Xslate->new( syntax => 'Kolon', # => will use Text::Xslate::Syntax::Kolon );
Specify syntax of Text::Xslate. Default, this module uses Text::Xslate::Syntax::TTerse.
$scanner->scan_file($result, $filename)
Scan file which is written by xslate. $result is the instance of Localizer::Dictionary to store results. $filename is file name of the target to scan.
$result
$filename
For example, if target file is follows;
[% IF xxx == l('term') %] [% END %] [% l('hello') %]
Scanner uses l('foobar') as msgid (in this case, 'foobar' will be msgid).
l('foobar')
msgid
$result will be like a following;
{ 'term' => { 'position' => [ [ 'path/to/xslate.html', 1 ] ] }, 'hello' => { 'position' => [ [ 'path/to/xslate.html', 4 ] ] } }
$scanner->scan($result, $filename, $data)
This method is almost the same as scan_file(). This method does not load file contents, it uses $data as file contents instead.
scan_file()
$data
This module is based on Locale::Maketext::Extract::Plugin::Xslate.
Copyright (C) Kazuhiro Osawa
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Kazuhiro Osawa, Tokuhiro Matsuno <tokuhirom@gmail.com>
To install Localizer::Scanner::Xslate, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Localizer::Scanner::Xslate
CPAN shell
perl -MCPAN -e shell install Localizer::Scanner::Xslate
For more information on module installation, please visit the detailed CPAN module installation guide.