METHODS

Constructors

$class->new( OPTIONS )

Create a new POT file. The initial header is generated for you, but it can be changed using the header() method.

Option Default

charset

<required>

date

now

filename

undef

index

{}

nr_plurals

2

plural_alg

n!=1

plural_forms

<constructed from nr_plurals and plural_alg>

textdomain

<required>

version

undef

charset => STRING
The character-set which is used for the output.
date => STRING
Overrule the date which is included in the generated header.
filename => STRING
Specify an output filename. The name can also be specified when write() is called.
index => HASH
A set of translations (Log::Report::Lexicon::PO objects), with msgid as key.
nr_plurals => INTEGER
The number of translations each of the translation with plural form need to have.
plural_alg => EXPRESSION
The algorithm to be used to calculate which translated msgstr to use.
plural_forms => RULE
[0.992] When this option is used, it overrules nr_plurals and plural_alg. The RULE should be a full "Plural-Forms" field.
textdomain => STRING
The package name, used in the directory structure to store the PO files.
version => STRING
» Error: charset parameter is required
» Error: textdomain parameter is required
$class->read( FILENAME, OPTIONS )

Read the POT information from FILENAME.

Option Default

charset

<required>

charset => STRING
The character-set which is used for the file. You must specify this explicitly, while it cannot be trustfully detected automatically.
$obj->write( [FILENAME|FILEHANDLE], OPTIONS )

When you pass an open FILEHANDLE, you are yourself responsible that the correct character-encoding (binmode) is set. When the write followed a read() or the filename was explicitly set with filename(), then you may omit the first parameter.

» Error: no filename or file-handle specified for PO

When a PO file is written, then a filename or file-handle must be specified explicitly, or set beforehand using the filename() method, or known because the write follows a read() of the file.

Attributes

$obj->charset

The character-set to be used for reading and writing. You do not need to be aware of Perl's internal encoding for the characters.

$obj->filename

Returns the FILENAME, as derived from read() or specified during initiation with new(filename).

$obj->index

Returns a HASH of all defined PO objects, organized by msgid. Please try to avoid using this: use msgid() for lookup and add() for adding translations.

Managing PO's

$obj->removeReferencesTo( FILENAME )

Remove all the references to the indicate FILENAME from all defined translations. Returns the number of refs left.

$obj->stats

Returns a HASH with some statistics about this POT table.

$obj->updated( [DATE] )

Replace the "PO-Revision-Date" with the specified DATE, or the current moment.

Translation

$obj->msgid( STRING )

Lookup the Log::Report::Lexicon::PO with the STRING. If you want to add a new translation, use add(). Returns undef when not defined.

$obj->msgstr( MSGID, [COUNT] )

Returns the translated string for MSGID. When COUNT is not specified, the translation string related to "1" is returned.

Administration

$obj->add( PO )

Add the information from a PO into this POT. If the msgid of the PO is already known, that is an error.

$obj->nrPlurals
See nrPlurals in Log::Report::Lexicon::Table.
$obj->pluralIndex( COUNT )
See pluralIndex in Log::Report::Lexicon::Table.
$obj->setupPluralAlgorithm
See setupPluralAlgorithm in Log::Report::Lexicon::Table.
$obj->translations( [ACTIVE] )

Returns a list with all defined Log::Report::Lexicon::PO objects. When the string ACTIVE is given as parameter, only objects which have references are returned.

» Error: only acceptable parameter is 'ACTIVE'