The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Locale::TextDomain::OO::Lexicon::Role::File - Helper role to add lexicon from file

$Id: File.pm 452 2013-12-21 06:12:01Z steffenw $

$HeadURL: svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/module/trunk/lib/Locale/TextDomain/OO/Lexicon/Role/File.pm $

VERSION

1.004

DESCRIPTION

This module provides methods to inplmement lexicon from file easy.

SYNOPSIS

    with qw(
        Locale::TextDomain::OO::Lexicon::Role::File
    );

SUBROUTINES/METHODS

attribute decode_code

Allows to implement your own way of decode messages. Add a code ref in constructor.

    decode_code => sub {
        my ($charset, $text) = @_;
        defined $text
            or return $text;

        return decode( $charset, $text );
    },

method lexicon_ref

    $self->lexicon_ref({
        # required
        search_dirs => [ qw( ./my_dir ./my_other_dir ) ],
        # optional
        gettext_to_maketext => $boolean,
        # optional
        decode => $boolean,
        # required
        data => [
            # e.g. de.mo, en.mo read from:
            # search_dir/de.mo
            # search_dir/en.mo
            '*::' => '*.mo',
            # e.g. de.mo en.mo read from:
            # search_dir/subdir/de/LC_MESSAGES/domain.mo
            # search_dir/subdir/en/LC_MESSAGES/domain.mo
            '*:LC_MESSAGES:domain' => 'subdir/*/LC_MESSAGES/domain.mo',
        ],
    });

EXAMPLE

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

DIAGNOSTICS

confess

CONFIGURATION AND ENVIRONMENT

none

DEPENDENCIES

Carp

Encode

English

File::Spec

Locale::TextDomain::OO::Singleton::Lexicon

Moo::Role

MooX::Types::MooseLike::Base

Path::Class

Path::Class::Rule

namespace::autoclean

Locale::TextDomain::OO::Lexicon::Role::ExtractHeader

Locale::TextDomain::OO::Lexicon::Role::GettextToMaketext

Locale::TextDomain::OO::Role::Logger

INCOMPATIBILITIES

not known

BUGS AND LIMITATIONS

none

SEE ALSO

Locale::TextDoamin::OO

AUTHOR

Steffen Winkler

LICENSE AND COPYRIGHT

Copyright (c) 2013, 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.