1Locale::TextDomain::OO:U:sLeerxiCcoonnt:r:iLRbooucltaeel:de::FP:ieTlreelx(t3DD)oocmuamienn:t:aOtOi:o:nLexicon::Role::File(3)
2
3
4

NAME

6       Locale::TextDomain::OO::Lexicon::Role::File - Helper role to add
7       lexicon from file
8
9       $Id: File.pm 698 2017-09-28 05:21:05Z steffenw $
10
11       $HeadURL:
12       svn+ssh://steffenw@svn.code.sf.net/p/perl-gettext-oo/code/module/trunk/lib/Locale/TextDomain/OO/Lexicon/Role/File.pm
13       $
14

VERSION

16       1.031
17

DESCRIPTION

19       This module provides methods to inplmement lexicon from file easy.
20

SYNOPSIS

22           with qw(
23               Locale::TextDomain::OO::Lexicon::Role::File
24           );
25

SUBROUTINES/METHODS

27   attribute decode_code
28       Allows to implement your own way of decode messages.  Add a code ref in
29       constructor.
30
31           decode_code => sub {
32               my ($charset, $text) = @_;
33               defined $text
34                   or return $text;
35
36               return decode( $charset, $text );
37           },
38
39   method lexicon_ref
40           $self->lexicon_ref({
41               # required
42               search_dirs => [ qw( ./my_dir ./my_other_dir ) ],
43               # optional
44               gettext_to_maketext => $boolean,
45               # optional
46               decode => $boolean,
47               # required
48               data => [
49                   # e.g. de.mo, en.mo read from:
50                   # search_dir/de.mo
51                   # search_dir/en.mo
52                   '*::' => '*.mo',
53
54                   # e.g. de.mo en.mo read from:
55                   # search_dir/subdir/de/LC_MESSAGES/domain.mo
56                   # search_dir/subdir/en/LC_MESSAGES/domain.mo
57                   '*:LC_MESSAGES:domain' => 'subdir/*/LC_MESSAGES/domain.mo',
58
59                   # Merge a region lexicon:
60                   # Take the header and messages of the "de::" lexicon,
61                   # overwrite the header and messages of the "de-at::" lexicon
62                   # and store that as "de-at::" lexicon with all messages now.
63                   merge_lexicon => 'de::', 'de-at::' => 'de-at::',
64
65                   # Copy a lexicon into another domain and/or category:
66                   copy_lexicon => 'i-default::' => 'i-default:LC_MESSAGES:domain',
67
68                   # Move a lexicon into another domain and/or category:
69                   move_lexicon => 'i-default::' => 'i-default:LC_MESSAGES:domain',
70
71                   # Delete a lexicon:
72                   delete_lexicon => 'i-default::',
73               ],
74           });
75
76   method logger
77       Set the logger and get back them
78
79           $lexicon_hash->logger(
80               sub {
81                   my ($message, $arg_ref) = @_;
82                   my $type = $arg_ref->{type};
83                   $log->$type($message);
84                   return;
85               },
86           );
87           $logger = $lexicon_hash->logger;
88
89       $arg_ref contains
90
91           object => $lexicon_hash, # the object itself
92           type   => 'debug',
93           event  => 'lexicon,load', # The logger will be copied to
94                                     # Locale::TextDomain::OO::Singleton::Lexicon
95                                     # so more events are possible.
96

EXAMPLE

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

DIAGNOSTICS

102       confess
103

CONFIGURATION AND ENVIRONMENT

105       none
106

DEPENDENCIES

108       Carp
109
110       Encode
111
112       English
113
114       Locale::TextDomain::OO::Singleton::Lexicon
115
116       Locale::TextDomain::OO::Util::ExtractHeader
117
118       Locale::TextDomain::OO::Util::JoinSplitLexiconKeys
119
120       Moo::Role
121
122       MooX::Types::MooseLike::Base
123
124       Path::Tiny
125
126       namespace::autoclean
127
128       Locale::TextDomain::OO::Lexicon::Role::GettextToMaketext
129
130       Locale::TextDomain::OO::Role::Logger
131

INCOMPATIBILITIES

133       not known
134

BUGS AND LIMITATIONS

136       none
137

SEE ALSO

139       Locale::TextDoamin::OO
140

AUTHOR

142       Steffen Winkler
143
145       Copyright (c) 2013 - 2017, Steffen Winkler "<steffenw at cpan.org>".
146       All rights reserved.
147
148       This module is free software; you can redistribute it and/or modify it
149       under the same terms as Perl itself.
150
151
152
153perl v5.28.0                    Lo2c0a1l7e-:0:9T-e2x8tDomain::OO::Lexicon::Role::File(3)
Impressum