Skip to content
No description or website provided.
Perl
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib/Localizer/Scanner
t
.gitignore
.travis.yml
Build.PL
Changes
LICENSE
META.json
README.md
cpanfile
minil.toml

README.md

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

DESCRIPTION

Localizer::Scanner::Xslate is localization tag scanner for Xslate templates.

This module finds [% l("foo") %] style tags from xslate template files.

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
    );
    
  • $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

This module is based on Locale::Maketext::Extract::Plugin::Xslate.

LICENSE

Copyright (C) Kazuhiro Osawa

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

AUTHOR

Kazuhiro Osawa, Tokuhiro Matsuno tokuhirom@gmail.com

Something went wrong with that request. Please try again.