-
-
15 Mar 2019 15:51:07 UTC
- Distribution: Locale-TextDomain-OO
- Module version: 1.017
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (0)
- Testers (346 / 0 / 1)
- Kwalitee
Bus factor: 1- 80.51% Coverage
- License: perl_5
- Perl: v5.8.0
- Activity
24 month- Tools
- Download (100.82KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Steffen Winkler <steffenw at cpan.org>
- Dependencies
- Carp
- Class::Load
- Clone
- Encode
- English
- Hash::Util
- JSON
- JSON::PP
- Locale::MO::File
- Locale::PO
- Locale::TextDomain::OO::Util
- Locale::TextDomain::OO::Util::ExtractHeader
- Locale::TextDomain::OO::Util::JoinSplitLexiconKeys
- Locale::Utils::PlaceholderBabelFish
- Locale::Utils::PlaceholderMaketext
- Locale::Utils::PlaceholderNamed
- Moo
- Moo::Role
- MooX::Singleton
- MooX::StrictConstructor
- MooX::Types::MooseLike::Base
- Path::Tiny
- Tie::Sub
- Try::Tiny
- namespace::autoclean
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- VERSION
- DESCRIPTION
- SYNOPSIS
- SUBROUTINES/METHODS
- EXAMPLE
- DIAGNOSTICS
- CONFIGURATION AND ENVIRONMENT
- DEPENDENCIES
- INCOMPATIBILITIES
- BUGS AND LIMITATIONS
- SEE ALSO
- AUTHOR
- LICENSE AND COPYRIGHT
NAME
Locale::TextDomain::OO::Lexicon::Role::StoreFilter - Filters the lexicon data before stored
$Id: StoreFilter.pm 573 2015-02-07 20:59:51Z steffenw $
$HeadURL: svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/module/trunk/lib/Locale/TextDomain/OO/Lexicon/Role/StoreFilter.pm $
VERSION
1.017
DESCRIPTION
This module filters the lexicon data before stored.
The idea is: Not all parts of lexicon are used by other programming languages.
Implements attributes "filter_language", "filter_category", "filter_domain" and "filter_project". There it is possible to store undef for ignore filter, a string to check equal, a regex reference to match or a code reference to do some more complicate things.
That filter removes also the key "plural_code" from header. That is an already prepared Perl code reference to calculate what plural form should used. The other language has to create the code again from key header key "plural". That contains that pseudo code from po/mo file without
;
and/or\n
at the end.SYNOPSIS
with qw( Locale::TextDomain::OO::Lexicon::Role::StoreFilter );
Usage of that optional filter
use Locale::TextDomain::OO::Lexicon::Store...; my $obj = Locale::TextDomain::OO::Lexicon::Store...->new( ... # all parameters optional filter_language => undef, filter_category => 'cat1', filter_domain => qr{ \A dom }xms, filter_project => sub { my $filter_name = shift; # $filter_name eq 'filter_project' return $_ eq 'my project'; # $_ contains the value }, ); $obj->copy; $obj->clear_filter; $obj->filter_language('en'); $obj->remove; $obj->to_...;
SUBROUTINES/METHODS
method filter_language, filter_category, filter_domain, filter_project
Set a filter as undef, string, regex or code reference.
method clear_filter
Set filter_language, filter_category, filter_domain, filter_project to undef.
$obj->clear_filter;
method copy
Copies lexicon entries with matching filter from singleton lexicon to data (new lexicon).
$obj->copy;
method remove
Removes lexicon entries with matching filter from data (new lexicon).
$obj->remove;
method data
Get back that filtered lexicon data.
$data = $obj->data;
EXAMPLE
Inside of this distribution is a directory named example. Run this *.pl files.
DIAGNOSTICS
none
CONFIGURATION AND ENVIRONMENT
none
DEPENDENCIES
Locale::TextDomain::OO::Singleton::Lexicon
Locale::TextDomain::OO::Util::JoinSplitLexiconKeys
INCOMPATIBILITIES
not known
BUGS AND LIMITATIONS
none
SEE ALSO
AUTHOR
Steffen Winkler
LICENSE AND COPYRIGHT
Copyright (c) 2013 - 2015, 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.
Module Install Instructions
To install Locale::TextDomain::OO, copy and paste the appropriate command in to your terminal.
cpanm Locale::TextDomain::OO
perl -MCPAN -e shell install Locale::TextDomain::OO
For more information on module installation, please visit the detailed CPAN module installation guide.