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 version 1.00
10
12 Called via Locale::Maketext::Lexicon:
13
14 package Hello::I18N;
15 use base 'Locale::Maketext';
16 use Locale::Maketext::Lexicon {
17 de => [Gettext => 'hello/de.mo'],
18 };
19
20 Directly calling "parse()":
21
22 use Locale::Maketext::Lexicon::Gettext;
23 my %Lexicon = %{ Locale::Maketext::Lexicon::Gettext->parse(<DATA>) };
24 __DATA__
25 #: Hello.pm:10
26 msgid "Hello, World!"
27 msgstr "Hallo, Welt!"
28
29 #: Hello.pm:11
30 msgid "You have %quant(%1,piece) of mail."
31 msgstr "Sie haben %quant(%1,Poststueck,Poststuecken)."
32
34 This module implements a perl-based "Gettext" parser for
35 Locale::Maketext. It transforms all %1, %2, <%*>... sequences to
36 "[_1]", "[_2]", "[_*]", and so on. It accepts either plain PO file, or
37 a MO file which will be handled with a pure-perl parser adapted from
38 Imacat's "Locale::Maketext::Gettext".
39
40 Since version 0.03, this module also looks for "%function(args...)" in
41 the lexicon strings, and transform it to "[function,args...]". Any %1,
42 %2... sequences inside the args will have their percent signs ("%")
43 replaced by underscores ("_").
44
45 The name of function above should begin with a letter or underscore,
46 followed by any number of alphanumeric characters and/or underscores.
47 As an exception, the function name may also consist of a single
48 asterisk ("*") or pound sign ("#"), which are "Locale::Maketext"'s
49 shorthands for "quant" and "numf", respectively.
50
51 As an additional feature, this module also parses MIME-header style
52 metadata specified in the null msgstr (""), and add them to the
53 %Lexicon with a "__" prefix. For example, the example above will set
54 "__Content-Type" to "text/plain; charset=iso8859-1", without the
55 newline or the colon.
56
57 Any normal entry that duplicates a metadata entry takes precedence.
58 Hence, a "msgid "__Content-Type"" line occurs anywhere should override
59 the above value.
60
62 use_fuzzy
63 When parsing PO files, fuzzy entries (entries marked with "#, fuzzy")
64 are silently ignored. If you wish to use fuzzy entries, specify a true
65 value to the "_use_fuzzy" option:
66
67 use Locale::Maketext::Lexicon {
68 de => [Gettext => 'hello/de.mo'],
69 _use_fuzzy => 1,
70 };
71
72 allow_empty
73 When parsing PO files, empty entries (entries with "msgstr """) are
74 silently ignored. If you wish to allow empty entries, specify a true
75 value to the "_allow_empty" option:
76
77 use Locale::Maketext::Lexicon {
78 de => [Gettext => 'hello/de.mo'],
79 _allow_empty => 1,
80 };
81
83 Locale::Maketext, Locale::Maketext::Lexicon
84
86 Audrey Tang <cpan@audreyt.org>
87
89 Copyright 2002-2013 by Audrey Tang <cpan@audreyt.org>.
90
91 This software is released under the MIT license cited below.
92
93 The "MIT" License
94 Permission is hereby granted, free of charge, to any person obtaining a
95 copy of this software and associated documentation files (the
96 "Software"), to deal in the Software without restriction, including
97 without limitation the rights to use, copy, modify, merge, publish,
98 distribute, sublicense, and/or sell copies of the Software, and to
99 permit persons to whom the Software is furnished to do so, subject to
100 the following 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
107 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
108 IN 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
111 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
112
114 • Clinton Gormley <drtech@cpan.org>
115
116 • Audrey Tang <cpan@audreyt.org>
117
119 This software is Copyright (c) 2014 by Audrey Tang.
120
121 This is free software, licensed under:
122
123 The MIT (X11) License
124
125
126
127perl v5.32.1 2021-01-L2o7cale::Maketext::Lexicon::Gettext(3)