Locale-TextDomain-OO-Extract-Xslate
view release on metacpan or search on metacpan
0.04 2018-12-05 23:07:23+01:00 Europe/Berlin
- Fix dependency specification
0.03 2018-12-05 20:24:12+01:00 Europe/Berlin
- Handle variable args to translation functions without
warnings ("__($foo)") - GH#3 - kgoess
- Handle "cascade with" statements - GH#4 - kgoess
- Handle 'nil' without warnings - GH#5 - kgoess
0.02 2017-01-16 22:31:32+01:00 Europe/Berlin
- Allow registration of custom translation methods (kgoess)
- Allow extraction of texts to be translated via filters (kgoess)
0.01 2015-11-08 20:35:03+01:00 Europe/Berlin
- Initial Release
META.json
META.yml
Makefile.PL
README
lib/Locale/TextDomain/OO/Extract/Xslate.pm
t/00-load.t
t/10-kolon.t
t/20-metakolon.t
t/99_check_manifest.t
t/data/kolon/a_variable.tx
t/data/kolon/cascade/base.tx
t/data/kolon/cascade/foo.tx
t/data/kolon/cascade/helpers.tx
t/data/kolon/custom.tx
t/data/kolon/filters.tx
t/data/kolon/functions.tx
t/data/kolon/methods.tx
t/data/kolon/nil.tx
t/data/metakolon/custom.tx
t/data/metakolon/filters.tx
t/data/metakolon/functions.tx
t/data/metakolon/methods.tx
t/10-kolon.t view on Meta::CPAN
$extract->filename( $fn );
$extract->extract;
}
my $got = $extract->lexicon_ref;
is_deeply( $got, $expected, "Succesful extraction from Kolon syntax templates with __(\$foo)" )
or warn Dumper $got;
is scalar @warnings, 0, "No warnings from __(\$foo) stuff"
or warn "warnings: @warnings";
}
# separate test for :cascade
{
$extract = Locale::TextDomain::OO::Extract::Xslate->new();
$expected = {
'i-default::' => {
'' => {
'msgstr' => {
'plural' => 'n != 1',
'nplurals' => 2
}
},
'The macro says: ' => { 'reference' => { 't/data/kolon/cascade/helpers.tx:1' => undef } },
'My Template!' => { 'reference' => { 't/data/kolon/cascade/base.tx:4' => undef } },
'My template body!' => { 'reference' => { 't/data/kolon/cascade/foo.tx:4' => undef } }
}
};
@files = (
qw(
t/data/kolon/cascade/helpers.tx
t/data/kolon/cascade/base.tx
t/data/kolon/cascade/foo.tx
)
);
for my $file ( map { path( $_ ) } @files ) {
my $fn = $file->relative( q{./} )->stringify;
$extract->clear;
$extract->filename( $fn );
$extract->extract;
}
my $got = $extract->lexicon_ref;
is_deeply( $got, $expected, "Succesful extraction from Kolon syntax templates with :cascade" )
or warn Dumper $got;
}
# separate test for <: if $x = nil :> warning bug,
{
my @warnings;
local $SIG{__WARN__} = sub { print STDERR @_; push @warnings, @_ };
$extract = Locale::TextDomain::OO::Extract::Xslate->new( debug => 0 );
$expected = {};
for my $file ( map { path( $_ ) } 't/data/kolon/nil.tx' ) {
t/data/kolon/cascade/base.tx view on Meta::CPAN
: cascade with cascade::helpers
: block title -> { # with default
[title: <: __('My Template!') :>]
: }
: block body -> { } # without default
t/data/kolon/cascade/foo.tx view on Meta::CPAN
: cascade cascade::base
: # uses default title
: around body -> {
: __('My template body!')
xXx <: some_macro('hi') :> xXx
: }
( run in 0.577 second using v1.01-cache-2.11-cpan-49f99fa48dc )