1Locale::Maketext::LexicUosne:r:GCeotntterxitb(u3t)ed PerLlocDaolceu:m:eMnatkaettieoxnt::Lexicon::Gettext(3)
2
3
4
6 Locale::Maketext::Lexicon::Gettext - PO and MO file parser for Maketext
7
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
31 This module implements a perl-based "Gettext" parser for
32 Locale::Maketext. It transforms all %1, %2, <%*>... sequences to
33 "[_1]", "[_2]", "[_*]", and so on. It accepts either plain PO file, or
34 a MO file which will be handled with a pure-perl parser adapted from
35 Imacat's "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
45 asterisk ("*") or pound sign ("#"), which are "Locale::Maketext"'s
46 shorthands 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
50 %Lexicon with a "__" prefix. For example, the example above will set
51 "__Content-Type" to "text/plain; charset=iso8859-1", without the
52 newline 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
59 use_fuzzy
60 When parsing PO files, fuzzy entries (entries marked with "#, fuzzy")
61 are silently ignored. If you wish to use fuzzy entries, specify a true
62 value to the "_use_fuzzy" option:
63
64 use Locale::Maketext::Lexicon {
65 de => [Gettext => 'hello/de.mo'],
66 _use_fuzzy => 1,
67 };
68
69 allow_empty
70 When parsing PO files, empty entries (entries with "msgstr """) are
71 silently ignored. If you wish to allow empty entries, specify a true
72 value to the "_allow_empty" option:
73
74 use Locale::Maketext::Lexicon {
75 de => [Gettext => 'hello/de.mo'],
76 _allow_empty => 1,
77 };
78
80 Locale::Maketext, Locale::Maketext::Lexicon
81
83 Audrey Tang <cpan@audreyt.org>
84
86 Copyright 2002, 2003, 2004, 2007 by Audrey Tang <cpan@audreyt.org>.
87
88 This software is released under the MIT license cited below.
89
90 The "MIT" License
91 Permission is hereby granted, free of charge, to any person obtaining a
92 copy of this software and associated documentation files (the
93 "Software"), to deal in the Software without restriction, including
94 without limitation the rights to use, copy, modify, merge, publish,
95 distribute, sublicense, and/or sell copies of the Software, and to
96 permit persons to whom the Software is furnished to do so, subject to
97 the following conditions:
98
99 The above copyright notice and this permission notice shall be included
100 in all copies or substantial portions of the Software.
101
102 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
103 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
104 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
105 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
106 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
107 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
108 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
109
110
111
112perl v5.12.2 2010-08-L2o8cale::Maketext::Lexicon::Gettext(3)