.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\" ========================================================================
.\"
.IX Title "Locale::MakePhrase::BackingStore 3"
.TH Locale::MakePhrase::BackingStore 3 "2006-03-20" "perl v5.10.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
Locale::MakePhrase::BackingStore \- base\-class of the backing store
functionality.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
This is a base-class, of storage-specific implementations for the
Locale::MakePhrase module.
.PP
The backing-store may choose to implement seperate files for each
language, or a single file for all languages. It may choose to
implement database lookup... and so on.
.PP
This base class implements a generic implementation, which can be used
as a starting point. You should also look at Locale::MakePhrase::BackingStore::<some module>
for more examples.
.PP
Locale::MakePhrase implements the following backing stores:
.IP "\(bu" 2
Single file for all languages (see backing store:
File)
.IP "\(bu" 2
Files stored within a directory (see backing store:
Directory)
.IP "\(bu" 2
Generic database table (see backing store:
Database)
.IP "\(bu" 2
PostgreSQL database table (see backing store:
Database::PostgreSQL)
.PP
Alternatively, you could implement an application specific backing
store by doing the following:
.IP "1." 3
Make a package which derives from this class.
.IP "2." 3
Implement the \fIinit()\fR method, retrieving any options that may have
been supplied to the constructor.
.IP "3." 3
Overload the \fIget_rules()\fR method, returning a list-reference of
Locale::MakePhrase::LanguageRule objects, from the translations
available from your backing store.
.PP
For an implementation which uses a text file, this could mean that you
would load the text file if it has changed, constructing the rule
objects during the load, then return a list-reference of objects which
match the request.
.PP
For a database implementation, you would need to query the database
for translations which match the request, then construct rule objects
from those translations.
.SH "API"
.IX Header "API"
The following methods are implemented:
.SS "\fInew()\fP"
.IX Subsection "new()"
Construct a backing store instance; arguments are passed to the \fIinit()\fR
method.
.ie n .SS "$self init([...])"
.el .SS "\f(CW$self\fP init([...])"
.IX Subsection "$self init([...])"
Allow sub-class to control construction. The sub-class must return
itself, so as to make construction succeed.
.SS "\e@rule_objs get_rules($context,$key,\e@languages)"
.IX Subsection "@rule_objs get_rules($context,$key,@languages)"
Returns a list-reference of rule objects which have just been
retrieved from the storage mechanism. The objects will have been
based on the values of the \f(CW$context\fR (which is a stringified version of
whatever get passed to \f(CW\*(C`context_translate\*(C'\fR or a value of undef), the
\&\f(CW$key\fR (which is your application text string) and the language tags
that Locale::MakePhrase determined for this instance.
.PP
Since this is a base class, you need to supply a real implementation,
although you can still use Locale::MakePhrase with this minimal
implementation, so as to allow you to continue application development.
.ie n .SS "$rule_obj \fImake_rule()\fP"
.el .SS "\f(CW$rule_obj\fP \fImake_rule()\fP"
.IX Subsection "$rule_obj make_rule()"
This is a helper routine for making a LanguageRule object. ie: you
would use it like this, within your \fIget_rules()\fR method:
.PP
.Vb 11
\& sub get_rules {
\& ...
\& my $rule_obj = $self\->make_rule(
\& key => $key,
\& language => $lang,
\& expression => $expression,
\& priority => $priority,
\& translation => $translation,
\& );
\& ...
\& }
.Ve
.PP
Thus, it takes a hash or hash_ref with the options: \f(CW\*(C`key\*(C'\fR,
\&\f(CW\*(C`language\*(C'\fR, \f(CW\*(C`expression\*(C'\fR, \f(CW\*(C`priority\*(C'\fR and \f(CW\*(C`translation\*(C'\fR
Copyright 2K16 - 2K18 Indonesian Hacker Rulez