1Locale::Maketext::ExtraUcste:r:PCloungtirni:b:uBtaeLsdoec(Pa3el)rel::DMoackuemteenxtta:t:iEoxntract::Plugin::Base(3)
2
3
4

NAME

6       Locale::Maketext::Extract::Plugin::Base - Base module for format parser
7       plugins
8

VERSION

10       version 1.00
11

SYNOPSIS

13           package My::Parser::Plugin;
14           use base qw(Locale::Maketext::Extract::Plugin::Base);
15
16           sub file_types {
17               return [qw( ext ext2 )]
18           }
19
20           sub extract {
21               my $self = shift;
22               local $_ = shift;
23
24               my $line = 1;
25
26               while (my $found = $self->routine_to_extract_strings) {
27                   $self->add_entry($str,[$filename,$line,$vars])
28               }
29
30               return;
31           }
32

DESCRIPTION

34       All format parser plugins in Locale::Maketext::Extract inherit from
35       Locale::Maketext::Extract::Plugin::Base.
36
37       If you want to write your own custom parser plugin, you will need to
38       inherit from this module, and provide "file_types()" and "extract()"
39       methods, as shown above.
40

METHODS

42       new()
43               $plugin = My::Parser->new(
44                   @file_types         # Optionally specify a list of recognised file types
45               )
46
47       add_entry()
48               $plugin->add_entry($str,$line,$vars)
49
50       "entries()"
51               $entries = $plugin->entries;
52
53       "clear()"
54               $plugin->clear
55
56           Clears all stored entries.
57
58       file_types()
59               @default_file_types = $plugin->file_types
60
61           Returns a list of recognised file types that your module knows how
62           to parse.
63
64           Each file type can be one of:
65
66           •   A plain string
67
68                  'pl'  => base filename is matched against qr/\.pl$/
69                  '*'   => all files are accepted
70
71           •   A regex
72
73                  qr/\.tt2?\./ => base filename is matched against this regex
74
75           •   A codref
76
77                   sub {}  => this codref is called as $coderef->($base_filename,$path_to_file)
78                              It should return true or false
79
80       extract()
81               $plugin->extract($filecontents);
82
83           extract() is the method that will be called to process the contents
84           of the current file.
85
86           When it finds a string that should be extracted, it should call
87
88              $self->add_entry($string,$line,$vars])
89
90           where $vars refers to any arguments that are being passed to the
91           localise function. For instance:
92
93              l("You found [quant,_1,file,files]",files_found)
94
95                string: "You found [quant,_1,file,files]"
96                vars  : (files_found)
97
98           IMPORTANT: a single plugin instance is used for all files, so if
99           you plan on storing state information in the $plugin object, this
100           should be cleared out at the beginning of "extract()"
101
102       known_file_type()
103               if ($plugin->known_file_type($filename_with_path)) {
104                   ....
105               }
106
107           Determines whether the current file should be handled by this
108           parser, based either on the list of file_types specified when this
109           object was created, or the default file_types specified in the
110           module.
111

SEE ALSO

113       xgettext.pl
114           for extracting translatable strings from common template systems
115           and perl source files.
116
117       Locale::Maketext::Lexicon
118       Locale::Maketext::Extract::Plugin::Perl
119       Locale::Maketext::Extract::Plugin::PPI
120       Locale::Maketext::Extract::Plugin::TT2
121       Locale::Maketext::Extract::Plugin::YAML
122       Locale::Maketext::Extract::Plugin::FormFu
123       Locale::Maketext::Extract::Plugin::Mason
124       Locale::Maketext::Extract::Plugin::TextTemplate
125       Locale::Maketext::Extract::Plugin::Generic
126

AUTHORS

128       Clinton Gormley [DRTECH] <clinton@traveljury.com>
129
131       Copyright 2002-2013 by Audrey Tang <cpan@audreyt.org>.
132
133       This software is released under the MIT license cited below.
134
135   The "MIT" License
136       Permission is hereby granted, free of charge, to any person obtaining a
137       copy of this software and associated documentation files (the
138       "Software"), to deal in the Software without restriction, including
139       without limitation the rights to use, copy, modify, merge, publish,
140       distribute, sublicense, and/or sell copies of the Software, and to
141       permit persons to whom the Software is furnished to do so, subject to
142       the following conditions:
143
144       The above copyright notice and this permission notice shall be included
145       in all copies or substantial portions of the Software.
146
147       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
148       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
149       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
150       IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
151       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
152       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
153       SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
154

AUTHORS

156       •   Clinton Gormley <drtech@cpan.org>
157
158       •   Audrey Tang <cpan@audreyt.org>
159
161       This software is Copyright (c) 2014 by Audrey Tang.
162
163       This is free software, licensed under:
164
165         The MIT (X11) License
166
167
168
169perl v5.34.0                      202L1o-c0a7l-e2:2:Maketext::Extract::Plugin::Base(3)
Impressum