Commit | Line | Data |
3fea05b9 |
1 | .\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.10) |
2 | .\" |
3 | .\" Standard preamble: |
4 | .\" ======================================================================== |
5 | .de Sp \" Vertical space (when we can't use .PP) |
6 | .if t .sp .5v |
7 | .if n .sp |
8 | .. |
9 | .de Vb \" Begin verbatim text |
10 | .ft CW |
11 | .nf |
12 | .ne \\$1 |
13 | .. |
14 | .de Ve \" End verbatim text |
15 | .ft R |
16 | .fi |
17 | .. |
18 | .\" Set up some character translations and predefined strings. \*(-- will |
19 | .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left |
20 | .\" double quote, and \*(R" will give a right double quote. \*(C+ will |
21 | .\" give a nicer C++. Capital omega is used to do unbreakable dashes and |
22 | .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, |
23 | .\" nothing in troff, for use with C<>. |
24 | .tr \(*W- |
25 | .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' |
26 | .ie n \{\ |
27 | . ds -- \(*W- |
28 | . ds PI pi |
29 | . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch |
30 | . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch |
31 | . ds L" "" |
32 | . ds R" "" |
33 | . ds C` "" |
34 | . ds C' "" |
35 | 'br\} |
36 | .el\{\ |
37 | . ds -- \|\(em\| |
38 | . ds PI \(*p |
39 | . ds L" `` |
40 | . ds R" '' |
41 | 'br\} |
42 | .\" |
43 | .\" Escape single quotes in literal strings from groff's Unicode transform. |
44 | .ie \n(.g .ds Aq \(aq |
45 | .el .ds Aq ' |
46 | .\" |
47 | .\" If the F register is turned on, we'll generate index entries on stderr for |
48 | .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
49 | .\" entries marked with X<> in POD. Of course, you'll have to process the |
50 | .\" output yourself in some meaningful fashion. |
51 | .ie \nF \{\ |
52 | . de IX |
53 | . tm Index:\\$1\t\\n%\t"\\$2" |
54 | .. |
55 | . nr % 0 |
56 | . rr F |
57 | .\} |
58 | .el \{\ |
59 | . de IX |
60 | .. |
61 | .\} |
62 | .\" |
63 | .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). |
64 | .\" Fear. Run. Save yourself. No user-serviceable parts. |
65 | . \" fudge factors for nroff and troff |
66 | .if n \{\ |
67 | . ds #H 0 |
68 | . ds #V .8m |
69 | . ds #F .3m |
70 | . ds #[ \f1 |
71 | . ds #] \fP |
72 | .\} |
73 | .if t \{\ |
74 | . ds #H ((1u-(\\\\n(.fu%2u))*.13m) |
75 | . ds #V .6m |
76 | . ds #F 0 |
77 | . ds #[ \& |
78 | . ds #] \& |
79 | .\} |
80 | . \" simple accents for nroff and troff |
81 | .if n \{\ |
82 | . ds ' \& |
83 | . ds ` \& |
84 | . ds ^ \& |
85 | . ds , \& |
86 | . ds ~ ~ |
87 | . ds / |
88 | .\} |
89 | .if t \{\ |
90 | . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" |
91 | . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' |
92 | . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' |
93 | . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' |
94 | . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' |
95 | . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' |
96 | .\} |
97 | . \" troff and (daisy-wheel) nroff accents |
98 | .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' |
99 | .ds 8 \h'\*(#H'\(*b\h'-\*(#H' |
100 | .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] |
101 | .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' |
102 | .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' |
103 | .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] |
104 | .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] |
105 | .ds ae a\h'-(\w'a'u*4/10)'e |
106 | .ds Ae A\h'-(\w'A'u*4/10)'E |
107 | . \" corrections for vroff |
108 | .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' |
109 | .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' |
110 | . \" for low resolution devices (crt and lpr) |
111 | .if \n(.H>23 .if \n(.V>19 \ |
112 | \{\ |
113 | . ds : e |
114 | . ds 8 ss |
115 | . ds o a |
116 | . ds d- d\h'-1'\(ga |
117 | . ds D- D\h'-1'\(hy |
118 | . ds th \o'bp' |
119 | . ds Th \o'LP' |
120 | . ds ae ae |
121 | . ds Ae AE |
122 | .\} |
123 | .rm #[ #] #H #V #F C |
124 | .\" ======================================================================== |
125 | .\" |
126 | .IX Title "Locale::Maketext::Simple 3" |
127 | .TH Locale::Maketext::Simple 3 "2009-08-17" "perl v5.8.7" "User Contributed Perl Documentation" |
128 | .\" For nroff, turn off justification. Always turn off hyphenation; it makes |
129 | .\" way too many mistakes in technical documents. |
130 | .if n .ad l |
131 | .nh |
132 | .SH "NAME" |
133 | Locale::Maketext::Simple \- Simple interface to Locale::Maketext::Lexicon |
134 | .SH "VERSION" |
135 | .IX Header "VERSION" |
136 | This document describes version 0.18 of Locale::Maketext::Simple, |
137 | released Septermber 8, 2006. |
138 | .SH "SYNOPSIS" |
139 | .IX Header "SYNOPSIS" |
140 | Minimal setup (looks for \fIauto/Foo/*.po\fR and \fIauto/Foo/*.mo\fR): |
141 | .PP |
142 | .Vb 6 |
143 | \& package Foo; |
144 | \& use Locale::Maketext::Simple; # exports \*(Aqloc\*(Aq |
145 | \& loc_lang(\*(Aqfr\*(Aq); # set language to French |
146 | \& sub hello { |
147 | \& print loc("Hello, [_1]!", "World"); |
148 | \& } |
149 | .Ve |
150 | .PP |
151 | More sophisticated example: |
152 | .PP |
153 | .Vb 10 |
154 | \& package Foo::Bar; |
155 | \& use Locale::Maketext::Simple ( |
156 | \& Class => \*(AqFoo\*(Aq, # search in auto/Foo/ |
157 | \& Style => \*(Aqgettext\*(Aq, # %1 instead of [_1] |
158 | \& Export => \*(Aqmaketext\*(Aq, # maketext() instead of loc() |
159 | \& Subclass => \*(AqL10N\*(Aq, # Foo::L10N instead of Foo::I18N |
160 | \& Decode => 1, # decode entries to unicode\-strings |
161 | \& Encoding => \*(Aqlocale\*(Aq, # but encode lexicons in current locale |
162 | \& # (needs Locale::Maketext::Lexicon 0.36) |
163 | \& ); |
164 | \& sub japh { |
165 | \& print maketext("Just another %1 hacker", "Perl"); |
166 | \& } |
167 | .Ve |
168 | .SH "DESCRIPTION" |
169 | .IX Header "DESCRIPTION" |
170 | This module is a simple wrapper around \fBLocale::Maketext::Lexicon\fR, |
171 | designed to alleviate the need of creating \fILanguage Classes\fR for |
172 | module authors. |
173 | .PP |
174 | The language used is chosen from the loc_lang call. If a lookup is not |
175 | possible, the i\-default language will be used. If the lookup is not in the |
176 | i\-default language, then the key will be returned. |
177 | .PP |
178 | If \fBLocale::Maketext::Lexicon\fR is not present, it implements a |
179 | minimal localization function by simply interpolating \f(CW\*(C`[_1]\*(C'\fR with |
180 | the first argument, \f(CW\*(C`[_2]\*(C'\fR with the second, etc. Interpolated |
181 | function like \f(CW\*(C`[quant,_1]\*(C'\fR are treated as \f(CW\*(C`[_1]\*(C'\fR, with the sole |
182 | exception of \f(CW\*(C`[tense,_1,X]\*(C'\fR, which will append \f(CW\*(C`ing\*(C'\fR to \f(CW\*(C`_1\*(C'\fR when |
183 | X is \f(CW\*(C`present\*(C'\fR, or appending \f(CW\*(C`ed\*(C'\fR to <_1> otherwise. |
184 | .SH "OPTIONS" |
185 | .IX Header "OPTIONS" |
186 | All options are passed either via the \f(CW\*(C`use\*(C'\fR statement, or via an |
187 | explicit \f(CW\*(C`import\*(C'\fR. |
188 | .SS "Class" |
189 | .IX Subsection "Class" |
190 | By default, \fBLocale::Maketext::Simple\fR draws its source from the |
191 | calling package's \fIauto/\fR directory; you can override this behaviour |
192 | by explicitly specifying another package as \f(CW\*(C`Class\*(C'\fR. |
193 | .SS "Path" |
194 | .IX Subsection "Path" |
195 | If your \s-1PO\s0 and \s-1MO\s0 files are under a path elsewhere than \f(CW\*(C`auto/\*(C'\fR, |
196 | you may specify it using the \f(CW\*(C`Path\*(C'\fR option. |
197 | .SS "Style" |
198 | .IX Subsection "Style" |
199 | By default, this module uses the \f(CW\*(C`maketext\*(C'\fR style of \f(CW\*(C`[_1]\*(C'\fR and |
200 | \&\f(CW\*(C`[quant,_1]\*(C'\fR for interpolation. Alternatively, you can specify the |
201 | \&\f(CW\*(C`gettext\*(C'\fR style, which uses \f(CW%1\fR and \f(CW\*(C`%quant(%1)\*(C'\fR for interpolation. |
202 | .PP |
203 | This option is case-insensitive. |
204 | .SS "Export" |
205 | .IX Subsection "Export" |
206 | By default, this module exports a single function, \f(CW\*(C`loc\*(C'\fR, into its |
207 | caller's namespace. You can set it to another name, or set it to |
208 | an empty string to disable exporting. |
209 | .SS "Subclass" |
210 | .IX Subsection "Subclass" |
211 | By default, this module creates an \f(CW\*(C`::I18N\*(C'\fR subclass under the |
212 | caller's package (or the package specified by \f(CW\*(C`Class\*(C'\fR), and stores |
213 | lexicon data in its subclasses. You can assign a name other than |
214 | \&\f(CW\*(C`I18N\*(C'\fR via this option. |
215 | .SS "Decode" |
216 | .IX Subsection "Decode" |
217 | If set to a true value, source entries will be converted into |
218 | utf8\-strings (available in Perl 5.6.1 or later). This feature |
219 | needs the \fBEncode\fR or \fBEncode::compat\fR module. |
220 | .SS "Encoding" |
221 | .IX Subsection "Encoding" |
222 | Specifies an encoding to store lexicon entries, instead of |
223 | utf8\-strings. If set to \f(CW\*(C`locale\*(C'\fR, the encoding from the current |
224 | locale setting is used. Implies a true value for \f(CW\*(C`Decode\*(C'\fR. |
225 | .SH "ACKNOWLEDGMENTS" |
226 | .IX Header "ACKNOWLEDGMENTS" |
227 | Thanks to Jos I. Boumans for suggesting this module to be written. |
228 | .PP |
229 | Thanks to Chia-Liang Kao for suggesting \f(CW\*(C`Path\*(C'\fR and \f(CW\*(C`loc_lang\*(C'\fR. |
230 | .SH "SEE ALSO" |
231 | .IX Header "SEE ALSO" |
232 | Locale::Maketext, Locale::Maketext::Lexicon |
233 | .SH "AUTHORS" |
234 | .IX Header "AUTHORS" |
235 | Audrey Tang <cpan@audreyt.org> |
236 | .SH "COPYRIGHT" |
237 | .IX Header "COPYRIGHT" |
238 | Copyright 2003, 2004, 2005, 2006 by Audrey Tang <cpan@audreyt.org>. |
239 | .PP |
240 | This software is released under the \s-1MIT\s0 license cited below. Additionally, |
241 | when this software is distributed with \fBPerl Kit, Version 5\fR, you may also |
242 | redistribute it and/or modify it under the same terms as Perl itself. |
243 | .ie n .SS "The ""\s-1MIT\s0"" License" |
244 | .el .SS "The ``\s-1MIT\s0'' License" |
245 | .IX Subsection "The MIT License" |
246 | Permission is hereby granted, free of charge, to any person obtaining a copy |
247 | of this software and associated documentation files (the \*(L"Software\*(R"), to deal |
248 | in the Software without restriction, including without limitation the rights |
249 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
250 | copies of the Software, and to permit persons to whom the Software is |
251 | furnished to do so, subject to the following conditions: |
252 | .PP |
253 | The above copyright notice and this permission notice shall be included in |
254 | all copies or substantial portions of the Software. |
255 | .PP |
256 | \&\s-1THE\s0 \s-1SOFTWARE\s0 \s-1IS\s0 \s-1PROVIDED\s0 \*(L"\s-1AS\s0 \s-1IS\s0\*(R", \s-1WITHOUT\s0 \s-1WARRANTY\s0 \s-1OF\s0 \s-1ANY\s0 \s-1KIND\s0, \s-1EXPRESS\s0 |
257 | \&\s-1OR\s0 \s-1IMPLIED\s0, \s-1INCLUDING\s0 \s-1BUT\s0 \s-1NOT\s0 \s-1LIMITED\s0 \s-1TO\s0 \s-1THE\s0 \s-1WARRANTIES\s0 \s-1OF\s0 \s-1MERCHANTABILITY\s0, |
258 | \&\s-1FITNESS\s0 \s-1FOR\s0 A \s-1PARTICULAR\s0 \s-1PURPOSE\s0 \s-1AND\s0 \s-1NONINFRINGEMENT\s0. \s-1IN\s0 \s-1NO\s0 \s-1EVENT\s0 \s-1SHALL\s0 |
259 | \&\s-1THE\s0 \s-1AUTHORS\s0 \s-1OR\s0 \s-1COPYRIGHT\s0 \s-1HOLDERS\s0 \s-1BE\s0 \s-1LIABLE\s0 \s-1FOR\s0 \s-1ANY\s0 \s-1CLAIM\s0, \s-1DAMAGES\s0 \s-1OR\s0 \s-1OTHER\s0 |
260 | \&\s-1LIABILITY\s0, \s-1WHETHER\s0 \s-1IN\s0 \s-1AN\s0 \s-1ACTION\s0 \s-1OF\s0 \s-1CONTRACT\s0, \s-1TORT\s0 \s-1OR\s0 \s-1OTHERWISE\s0, \s-1ARISING\s0 |
261 | \&\s-1FROM\s0, \s-1OUT\s0 \s-1OF\s0 \s-1OR\s0 \s-1IN\s0 \s-1CONNECTION\s0 \s-1WITH\s0 \s-1THE\s0 \s-1SOFTWARE\s0 \s-1OR\s0 \s-1THE\s0 \s-1USE\s0 \s-1OR\s0 \s-1OTHER\s0 |
262 | \&\s-1DEALINGS\s0 \s-1IN\s0 \s-1THE\s0 \s-1SOFTWARE\s0. |