1Locale::TextDomain::OO:U:sLeerxiCcoonnt:r:iFbiuLltoeec:da:lPPeOe:(r:3lT)eDxotcDuommeanitna:t:iOoOn::Lexicon::File::PO(3)
2
3
4

NAME

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

VERSION

15       1.031
16

DESCRIPTION

18       This module reads a gettext po file into the lexicon.
19

SYNOPSIS

21           use Locale::TextDomain::OO::Lexicon::File::PO;
22           use Log::Any qw($log);
23
24           $logger = Locale::TextDomain::OO::Lexicon::File::PO
25               ->new(
26                   # all parameters are optional
27                   decode_code => sub {
28                       my ($charset, $text) = @_;
29                       defined $text
30                           or return $text;
31                       return decode( $charset, $text );
32                   },
33                   # optional
34                   logger => sub {
35                       my ($message, $arg_ref) = @_;
36                       my $type = $arg_ref->{type}; # debug
37                       $log->$type($message);
38                       return;
39                   },
40               )
41               ->lexicon_ref({
42                   # required
43                   search_dirs => [ qw( ./my_dir ./my_other_dir ) ],
44                   # optional
45                   gettext_to_maketext => $boolean,
46                   # optional
47                   decode => $boolean,
48                   # required
49                   data => [
50                       # e.g. de.po, en.po read from:
51                       # search_dir/de.po
52                       # search_dir/en.po
53                       '*::' => '*.po',
54
55                       # e.g. de.po en.po read from:
56                       # search_dir/subdir/de/LC_MESSAGES/domain.po
57                       # search_dir/subdir/en/LC_MESSAGES/domain.po
58                       '*:LC_MESSAGES:domain' => 'subdir/*/LC_MESSAGES/domain.po',
59
60                       # Merge a region lexicon:
61                       # Take the header and messages of the "de::" lexicon,
62                       # overwrite the header and messages of the "de-at::" lexicon
63                       # and store that as "de-at::" lexicon with all messages now.
64                       merge_lexicon => 'de::', 'de-at::' => 'de-at::',
65
66                       # Copy a lexicon into another domain and/or category:
67                       copy_lexicon => 'i-default::' => 'i-default:LC_MESSAGES:domain',
68
69                       # Move a lexicon into another domain and/or category:
70                       move_lexicon => 'i-default::' => 'i-default:LC_MESSAGES:domain',
71
72                       # Delete a lexicon:
73                       delete_lexicon => 'i-default::',
74                   ],
75               })
76               ->logger;
77

SUBROUTINES/METHODS

79   method new
80       see SYNOPSIS
81
82   method lexicon_ref
83       See SYNOPSIS.
84
85   method read_messages
86       Called from Locale::TextDomain::OO::Lexicon::Role::File to run the po
87       file specific code.
88
89           $messages_ref = $self->read_messages($filename);
90
91   method logger
92       Set the logger and get back them
93
94           $lexicon_file_po->logger(
95               sub {
96                   my ($message, $arg_ref) = @_;
97                   my $type = $arg_ref->{type};
98                   $log->$type($message);
99                   return;
100               },
101           );
102           $logger = $lexicon_hash->logger;
103
104       $arg_ref contains
105
106           object => $lexicon_file_po, # the object itself
107           type   => 'debug',
108           event  => 'lexicon,load', # The logger will be copied to
109                                     # Locale::TextDomain::OO::Singleton::Lexicon
110                                     # so more events are possible.
111

EXAMPLE

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

DIAGNOSTICS

117       none
118

CONFIGURATION AND ENVIRONMENT

120       none
121

DEPENDENCIES

123       Locale::PO
124
125       Moo
126
127       MooX::StrictConstructor
128
129       Locale::TextDomain::OO::Lexicon::Role::File
130

INCOMPATIBILITIES

132       not known
133

BUGS AND LIMITATIONS

135       none
136

SEE ALSO

138       Locale::TextDoamin::OO
139

AUTHOR

141       Steffen Winkler
142
144       Copyright (c) 2014 - 2017, Steffen Winkler "<steffenw at cpan.org>".
145       All rights reserved.
146
147       This module is free software; you can redistribute it and/or modify it
148       under the same terms as Perl itself.
149
150
151
152perl v5.32.0                      2L0o2c0a-l0e7:-:2T8extDomain::OO::Lexicon::File::PO(3)
Impressum