1Locale::Maketext::LexicUosne:r:GCeotntterxitb(u3t)ed PerLlocDaolceu:m:eMnatkaettieoxnt::Lexicon::Gettext(3)
2
3
4

NAME

6       Locale::Maketext::Lexicon::Gettext - PO and MO file parser for Maketext
7

SYNOPSIS

9       Called via Locale::Maketext::Lexicon:
10
11           package Hello::I18N;
12           use base 'Locale::Maketext';
13           use Locale::Maketext::Lexicon {
14               de => [Gettext => 'hello/de.mo'],
15           };
16
17       Directly calling "parse()":
18
19           use Locale::Maketext::Lexicon::Gettext;
20           my %Lexicon = %{ Locale::Maketext::Lexicon::Gettext->parse(<DATA>) };
21           __DATA__
22           #: Hello.pm:10
23           msgid "Hello, World!"
24           msgstr "Hallo, Welt!"
25
26           #: Hello.pm:11
27           msgid "You have %quant(%1,piece) of mail."
28           msgstr "Sie haben %quant(%1,Poststueck,Poststuecken)."
29

DESCRIPTION

31       This module implements a perl-based "Gettext" parser for Locale::Make‐
32       text. It transforms all %1, %2, <%*>... sequences to "[_1]", "[_2]",
33       "[_*]", and so on.  It accepts either plain PO file, or a MO file which
34       will be handled with a pure-perl parser adapted from Imacat's
35       "Locale::Maketext::Gettext".
36
37       Since version 0.03, this module also looks for "%function(args...)"  in
38       the lexicon strings, and transform it to "[function,args...]".  Any %1,
39       %2... sequences inside the args will have their percent signs ("%")
40       replaced by underscores ("_").
41
42       The name of function above should begin with a letter or underscore,
43       followed by any number of alphanumeric characters and/or underscores.
44       As an exception, the function name may also consist of a single aster‐
45       isk ("*") or pound sign ("#"), which are "Locale::Maketext"'s short‐
46       hands for "quant" and "numf", respectively.
47
48       As an additional feature, this module also parses MIME-header style
49       metadata specified in the null msgstr (""), and add them to the %Lexi‐
50       con with a "__" prefix.  For example, the example above will set
51       "__Content-Type" to "text/plain; charset=iso8859-1", without the new‐
52       line or the colon.
53
54       Any normal entry that duplicates a metadata entry takes precedence.
55       Hence, a "msgid "__Content-Type"" line occurs anywhere should override
56       the above value.
57

OPTIONS

59       use_fuzzy
60
61       When parsing PO files, fuzzy entries (entries marked with "#, fuzzy")
62       are silently ignored.  If you wish to use fuzzy entries, specify a true
63       value to the "_use_fuzzy" option:
64
65           use Locale::Maketext::Lexicon {
66               de => [Gettext => 'hello/de.mo'],
67               _use_fuzzy => 1,
68           };
69
70       allow_empty
71
72       When parsing PO files, empty entries (entries with "msgstr """) are
73       silently ignored.  If you wish to allow empty entries, specify a true
74       value to the "_allow_empty" option:
75
76           use Locale::Maketext::Lexicon {
77               de => [Gettext => 'hello/de.mo'],
78               _allow_empty => 1,
79           };
80

SEE ALSO

82       Locale::Maketext, Locale::Maketext::Lexicon
83

AUTHORS

85       Audrey Tang <cpan@audreyt.org>
86
88       Copyright 2002, 2003, 2004, 2007 by Audrey Tang <cpan@audreyt.org>.
89
90       This software is released under the MIT license cited below.
91
92       The "MIT" License
93
94       Permission is hereby granted, free of charge, to any person obtaining a
95       copy of this software and associated documentation files (the "Soft‐
96       ware"), to deal in the Software without restriction, including without
97       limitation the rights to use, copy, modify, merge, publish, distribute,
98       sublicense, and/or sell copies of the Software, and to permit persons
99       to whom the Software is furnished to do so, subject to the following
100       conditions:
101
102       The above copyright notice and this permission notice shall be included
103       in all copies or substantial portions of the Software.
104
105       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
106       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER‐
107       CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
108       NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
109       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
110       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT‐
111       WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
112
113
114
115perl v5.8.8                       2008-01-L0o7cale::Maketext::Lexicon::Gettext(3)
Impressum