1Locale::Maketext::SimplUes(e3r)Contributed Perl DocumentLaotciaolne::Maketext::Simple(3)
2
3
4

NAME

6       Locale::Maketext::Simple - Simple interface to Locale::Maketext::Lexi‐
7       con
8

VERSION

10       This document describes version 0.18 of Locale::Maketext::Simple,
11       released Septermber 8, 2006.
12

SYNOPSIS

14       Minimal setup (looks for auto/Foo/*.po and auto/Foo/*.mo):
15
16           package Foo;
17           use Locale::Maketext::Simple;       # exports 'loc'
18           loc_lang('fr');                     # set language to French
19           sub hello {
20               print loc("Hello, [_1]!", "World");
21           }
22
23       More sophisticated example:
24
25           package Foo::Bar;
26           use Locale::Maketext::Simple (
27               Class       => 'Foo',       # search in auto/Foo/
28               Style       => 'gettext',   # %1 instead of [_1]
29               Export      => 'maketext',  # maketext() instead of loc()
30               Subclass    => 'L10N',      # Foo::L10N instead of Foo::I18N
31               Decode      => 1,           # decode entries to unicode-strings
32               Encoding    => 'locale',    # but encode lexicons in current locale
33                                           # (needs Locale::Maketext::Lexicon 0.36)
34           );
35           sub japh {
36               print maketext("Just another %1 hacker", "Perl");
37           }
38

DESCRIPTION

40       This module is a simple wrapper around Locale::Maketext::Lexicon,
41       designed to alleviate the need of creating Language Classes for module
42       authors.
43
44       If Locale::Maketext::Lexicon is not present, it implements a minimal
45       localization function by simply interpolating "[_1]" with the first
46       argument, "[_2]" with the second, etc.  Interpolated function like
47       "[quant,_1]" are treated as "[_1]", with the sole exception of
48       "[tense,_1,X]", which will append "ing" to "_1" when X is "present", or
49       appending "ed" to <_1> otherwise.
50

OPTIONS

52       All options are passed either via the "use" statement, or via an
53       explicit "import".
54
55       Class
56
57       By default, Locale::Maketext::Simple draws its source from the calling
58       package's auto/ directory; you can override this behaviour by explic‐
59       itly specifying another package as "Class".
60
61       Path
62
63       If your PO and MO files are under a path elsewhere than "auto/", you
64       may specify it using the "Path" option.
65
66       Style
67
68       By default, this module uses the "maketext" style of "[_1]" and
69       "[quant,_1]" for interpolation.  Alternatively, you can specify the
70       "gettext" style, which uses %1 and "%quant(%1)" for interpolation.
71
72       This option is case-insensitive.
73
74       Export
75
76       By default, this module exports a single function, "loc", into its
77       caller's namespace.  You can set it to another name, or set it to an
78       empty string to disable exporting.
79
80       Subclass
81
82       By default, this module creates an "::I18N" subclass under the caller's
83       package (or the package specified by "Class"), and stores lexicon data
84       in its subclasses.  You can assign a name other than "I18N" via this
85       option.
86
87       Decode
88
89       If set to a true value, source entries will be converted into
90       utf8-strings (available in Perl 5.6.1 or later).  This feature needs
91       the Encode or Encode::compat module.
92
93       Encoding
94
95       Specifies an encoding to store lexicon entries, instead of
96       utf8-strings.  If set to "locale", the encoding from the current locale
97       setting is used.  Implies a true value for "Decode".
98

ACKNOWLEDGMENTS

100       Thanks to Jos I. Boumans for suggesting this module to be written.
101
102       Thanks to Chia-Liang Kao for suggesting "Path" and "loc_lang".
103

SEE ALSO

105       Locale::Maketext, Locale::Maketext::Lexicon
106

AUTHORS

108       Audrey Tang <cpan@audreyt.org>
109
111       Copyright 2003, 2004, 2005, 2006 by Audrey Tang <cpan@audreyt.org>.
112
113       This software is released under the MIT license cited below.  Addition‐
114       ally, when this software is distributed with Perl Kit, Version 5, you
115       may also redistribute it and/or modify it under the same terms as Perl
116       itself.
117
118       The "MIT" License
119
120       Permission is hereby granted, free of charge, to any person obtaining a
121       copy of this software and associated documentation files (the "Soft‐
122       ware"), to deal in the Software without restriction, including without
123       limitation the rights to use, copy, modify, merge, publish, distribute,
124       sublicense, and/or sell copies of the Software, and to permit persons
125       to whom the Software is furnished to do so, subject to the following
126       conditions:
127
128       The above copyright notice and this permission notice shall be included
129       in all copies or substantial portions of the Software.
130
131       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
132       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER‐
133       CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
134       NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
135       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
136       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT‐
137       WARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
138
139
140
141perl v5.8.8                       2006-09-08       Locale::Maketext::Simple(3)
Impressum