Locale:...eFilter(3)

πŸ“¦
version 1.036 Β· 2 versions
, in fedora 43

πŸ’– Locale::TextDomain::OO::Lexicon::Role::StoreFilter β€” the vibe ✨

okay bestie, this is a page from the User Contributed Perl Documentation for the module Locale::TextDomain::OO::Lexicon::Role::StoreFilter, and it's literally a filter that sifts the lexicon data before it gets stored. no cap.

$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. it's giving bouncer at the club door but for lexicon data πŸ’…

The idea is: Not all parts of lexicon are used by other programming languages. (not every language needs every lil crumb of the lexicon, and that's okay!)

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. so basically you have four whole ways to flex on the filtering: ignore it, match it exactly, regex it, or go full main-character with a sub 🫢

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.

🚨 heads up bestie: plural_code gets yeeted out of the header by this filter. it's a Perl code ref that was already prepped to figure out which plural form to use. other languages gotta rebuild that code themselves from the header key plural, which holds the pseudo code straight from the po/mo file β€” minus any trailing ";" and/or "\n".

πŸŽ€ 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_...;

see how it's all optional? the params are just there if you want them, queen πŸ‘‘


πŸ¦‹ SUBROUTINES/METHODS πŸ¦‹

method filter_language, filter_category, filter_domain, filter_project

Set a filter as undef, string, regex or code reference. that's the whole menu β€” pick your fighter ⭐

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. it's yours, you earned it πŸ’œ

    $data = $obj->data;

🌸 EXAMPLE 🌸

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

🧚 go on, run them, they don't bite (probably)

πŸ’€ DIAGNOSTICS πŸ’€

none


πŸ“ CONFIGURATION AND ENVIRONMENT πŸ“

none


πŸ‘‘ DEPENDENCIES πŸ‘‘

  • Carp
  • Clone
  • Locale::TextDomain::OO::Singleton::Lexicon
  • Locale::TextDomain::OO::Util::JoinSplitLexiconKeys
  • Moo::Role
  • MooX::Types::MooseLike::Base
  • namespace::autoclean

that's the whole squad, no extras, no surprise guests πŸ™ˆ


πŸ’… INCOMPATIBILITIES πŸ’…

not known


😭 BUGS AND LIMITATIONS 😭

none


πŸ”₯ SEE ALSO πŸ”₯

Locale::TextDoamin::OO

⭐ (yes we're spelling it exactly like the original, no editing the lore, that's the rule periodt)

πŸ’– AUTHOR πŸ’–

Steffen Winkler


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.


and that's the whole page bestie 🫢 this lil icon came from perl v5.42.0, dated 2025-07-25 β€” and yes, Locale:...eFilter(3) is still out here living its best life in the manual. iykyk βœ¨πŸ’…

πŸ“¦ where this page comes from