++ed by:
AWNCORP

1 PAUSE user

MATSUNO★…Tokuhiro
and 2 contributors

NAME

Localizer::Scanner::Xslate - Scanner for Text::Xslate style file

SYNOPSIS

    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');

METHODS

  • 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
        );
    syntax: String

    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.

    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).

    $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.

SEE ALSO

Locale::Maketext::Extract::Plugin::Xslate

LICENSE

Copyright (C) Tokuhiro Matsuno.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.