MAN page from CentOS 6 psrk-perl-Locale-Maketext-Simple-0.21-27.5.noarch.rpm
Locale::Maketext::Simple
Section: Perl Programmers Reference Guide (3pm)
Updated: 2011-06-01
Index NAME
Locale::Maketext::Simple - Simple interface to Locale::Maketext::Lexicon
VERSION
This document describes version 0.18 of Locale::Maketext::Simple,released Septermber 8, 2006.
SYNOPSIS
Minimal setup (looks for
auto/Foo/*.po and
auto/Foo/*.mo):
package Foo; use Locale::Maketext::Simple; # exports 'loc' loc_lang('fr'); # set language to French sub hello { print loc("Hello, [_1]!", "World"); }
More sophisticated example:
package Foo::Bar; use Locale::Maketext::Simple ( Class => 'Foo', # search in auto/Foo/ Style => 'gettext', # %1 instead of [_1] Export => 'maketext', # maketext() instead of loc() Subclass => 'L10N', # Foo::L10N instead of Foo::I18N Decode => 1, # decode entries to unicode-strings Encoding => 'locale', # but encode lexicons in current locale # (needs Locale::Maketext::Lexicon 0.36) ); sub japh { print maketext("Just another %1 hacker", "Perl"); }
DESCRIPTION
This module is a simple wrapper around
Locale::Maketext::Lexicon,designed to alleviate the need of creating
Language Classes formodule authors.
The language used is chosen from the loc_lang call. If a lookup is notpossible, the i-default language will be used. If the lookup is not in thei-default language, then the key will be returned.
If Locale::Maketext::Lexicon is not present, it implements aminimal localization function by simply interpolating "[_1]" withthe first argument, "[_2]" with the second, etc. Interpolatedfunction like "[quant,_1]" are treated as "[_1]", with the soleexception of "[tense,_1,X]", which will append "ing" to "_1" whenX is "present", or appending "ed" to <_1> otherwise.
OPTIONS
All options are passed either via the
"use" statement, or via anexplicit
"import".
Class
By default,
Locale::Maketext::Simple draws its source from thecalling package's
auto/ directory; you can override this behaviourby explicitly specifying another package as
"Class".
Path
If your
PO and
MO files are under a path elsewhere than
"auto/",you may specify it using the
"Path" option.
Style
By default, this module uses the
"maketext" style of
"[_1]" and
"[quant,_1]" for interpolation. Alternatively, you can specify the
"gettext" style, which uses
%1 and
"%quant(%1)" for interpolation.
This option is case-insensitive.
Export
By default, this module exports a single function,
"loc", into itscaller's namespace. You can set it to another name, or set it toan empty string to disable exporting.
Subclass
By default, this module creates an
"::I18N" subclass under thecaller's package (or the package specified by
"Class"), and storeslexicon data in its subclasses. You can assign a name other than
"I18N" via this option.
Decode
If set to a true value, source entries will be converted intoutf8-strings (available in Perl 5.6.1 or later). This featureneeds the
Encode or
Encode::compat module.
Encoding
Specifies an encoding to store lexicon entries, instead ofutf8-strings. If set to
"locale", the encoding from the currentlocale setting is used. Implies a true value for
"Decode".
ACKNOWLEDGMENTS
Thanks to Jos I. Boumans for suggesting this module to be written.
Thanks to Chia-Liang Kao for suggesting "Path" and "loc_lang".
SEE ALSO
Locale::Maketext, Locale::Maketext::Lexicon
AUTHORS
Audrey Tang <cpanAATTaudreyt.org>
COPYRIGHT
Copyright 2003, 2004, 2005, 2006 by Audrey Tang <cpanAATTaudreyt.org>.
This software is released under the MIT license cited below. Additionally,when this software is distributed with Perl Kit, Version 5, you may alsoredistribute it and/or modify it under the same terms as Perl itself.
The MIT License
Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the ``Software''), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALLTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHERDEALINGS IN THE SOFTWARE.
Index
- NAME
- VERSION
- SYNOPSIS
- DESCRIPTION
- OPTIONS
- Class
- Path
- Style
- Export
- Subclass
- Decode
- Encoding
- ACKNOWLEDGMENTS
- SEE ALSO
- AUTHORS
- COPYRIGHT
- The MIT License
This document was created byman2html,using the manual pages.