1Locale::TextDomain::OO:U:sLeerxiCcoonnt:r:iLRbooucltaeel:de::FP:ieTlreelx(t3DD)oocmuamienn:t:aOtOi:o:nLexicon::Role::File(3)
2
3
4
6 Locale::TextDomain::OO::Lexicon::Role::File - Helper role to add
7 lexicon from file
8
9 $Id: File.pm 722 2018-12-21 12:24:14Z 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
16 1.034
17
19 This module provides methods to inplmement lexicon from file easy.
20
22 with qw(
23 Locale::TextDomain::OO::Lexicon::Role::File
24 );
25
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
98 Inside of this distribution is a directory named example. Run this
99 *.pl files.
100
102 confess
103
105 none
106
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
133 not known
134
136 none
137
139 Locale::TextDoamin::OO
140
142 Steffen Winkler
143
145 Copyright (c) 2013 - 2018, 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.34.0 Lo2c0a2l2e-:0:1T-e2x1tDomain::OO::Lexicon::Role::File(3)