NAME Locale::TextDomain::OO::Extract::YAML - Extracts internationalization data from HTML::FormFu field definition YAML file

$Id: YAML.pm 695 2017-09-02 09:24:08Z steffenw $

$HeadURL: svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/extract/trunk/lib/Locale/TextDomain/OO/Extract/YAML.pm $

VERSION

2.011

DESCRIPTION

This module extracts internationalization data from Template code.

Implemented rules:

# Maketext
label_loc:'...'
label_loc:"..."
label_loc:...

# Gettext
label__:'...'
label__:"..."
label__:...

# Gettext::Loc
label_loc_:'...'
label_loc_:"..."
label_loc_:...

# BabelFish::loc
label_loc_b:'...'
label_loc_b:"..."
label_loc_b:...

Instead of label also possible for content and value.

Whitespace is allowed everywhere. Quote and escape any text like: ' text {placeholder} \\ \' '

SYNOPSIS

use Locale::TextDomain::OO::Extract::YAML;
use Path::Tiny qw(path);

my $extractor = Locale::TextDomain::OO::Extract::YAML->new(
    # optional filter parameter, the default is ['all'],
    # the following means:
    # extract for all plugins but not for Plugin
    # Locale::TextDomain::OO::Plugin::Maketext
    filter => [ qw(
        all
        !Maketext
    ) ],
);
for ( @files ) {
    $extractor->clear;
    $extractor->filename($_);            # dir/filename for reference
    $extractor->content_ref( \( path($_)->slurp_utf8 ) );
    $extractor->project('my project');   # set or default undef is used
    $extractor->category('LC_MESSAGES'); # set or default q{} is used
    $extractor->domain('my domain');     # set or default q{} is used
    $extractor->extract;
}
... = $extractor->lexicon_ref;

SUBROUTINES/METHODS

method new

All parameters are optional. See Locale::TextDomain::OO::Extract to replace the defaults.

my $extractor = Locale::TextDomain::OO::Extract::YAML->new;

method filter

Ignore some of 'all' or define what to scan. See SYNOPSIS and DESCRIPTION for how and what.

my $array_ref = $extractor->filter;

$extractor->filter(['all']); # the default

method preprocess (called by method extract)

This method removes all comments.

$extractor->preprocess;

method stack_item_mapping (called by method extract)

This method maps the matched stuff as lexicon item.

$extractor->stack_item_mapping;

method extract

This method runs the extraction.

$extractor->extract;

EXAMPLE

Inside of this distribution is a directory named example. Run this *.pl files.

DIAGNOSTICS

none

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

Moo

MooX::Types::MooseLike::Base

namespace::autoclean

Locale::TextDomain::OO::Extract::Base::RegexBasedExtractor

Locale::TextDomain::OO::Extract::Role::File

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

none

SEE ALSO

Locale::TextDoamin::OO

Template

AUTHOR

Steffen Winkler

LICENSE AND COPYRIGHT

Copyright (c) 2014 - 2017, Steffen Winkler <steffenw at cpan.org>. All rights reserved.

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