Log::Report::Lexicon::Table3pm
Generic interface to translation tables
Usage
# use one of the extensions, for instance:my $pot = Log::Report::Lexicon::POT->read('po/nl.po', charset => 'utf-8')or panic;
Inheritance
Log::Report::Lexicon::Table is extended byLog::Report::Lexicon::MOTcompactLog::Report::Lexicon::POTLog::Report::Lexicon::POTcompact
Overview
This base class defines the generic interface for translation tables.
Currently, there are three extensions:
- •
-
Log::Report::Lexicon::POT
This is a relatively heavy implementation, used to read but also to write PO files. It is used by xgettext-perl, for instance, to administer the collection of discovered msgid's.
- •
-
Log::Report::Lexicon::POTcompact
Light-weighted read-only access to PO-file information.
- •
-
Log::Report::Lexicon::MOTcompact
Read-only access to MO-file information. These binary MO-files are super efficient.
Methods
Constructors
- Log::Report::Lexicon::Table->
new(%options)
Attributes
Managing PO's
Translation
- $obj->
msgid( STRING, [$msgctxt] ) -
Lookup the Log::Report::Lexicon::PO with the STRING. Returns
"undef"when not defined.
- $obj->
msgstr( $msgid, [$count, $msgctxt] ) -
Returns the translated string for
$msgid. When not specified,$countis 1.
Administration
- $obj->
add($po) -
Add the information from a
$pointo this POT. If the msgid of the$pois already known, that is an error.
- $obj->
header($field) -
The translation of a blank MSGID is used to store a MIME header, which contains some meta-data. The
$fieldvalue is looked-up (case-insensitive) and returned.
- $obj->
nrPlurals() -
Returns the number of plurals, when not known then '2'.
- $obj->
pluralIndex($count) -
Returns the msgstr index used to translate a value of
$count.
- $obj->
setupPluralAlgorithm() -
This method needs to be called after setting (reading or creating) a new table header, to interpret the plural algorithm as specified in the
"Plural-Forms"header field. [1.09] The header field is not required when not used.A full list of plural forms per language can be found at http://docs.translatehouse.org/projects/localization-guide/en/latest/l10n/pluralforms.html
- $obj->
translations( [$active] ) -
Returns a list with all defined Log::Report::Lexicon::PO objects. When the string
$activeis given as parameter, only objects which have references are returned.
Diagnostics
- Error: only acceptable parameter is 'ACTIVE'
Releases
6 releases since Debian 8 (Jessie); the text changed 4 times.