Log::Report::Lexicon::MOTcompact3pm
Use translations from an mo file
Usage
# using a MO table efficientlymy $mot = Log::Report::Lexicon::MOTcompact->read('mo/nl.mo')or die;my $header = $mot->msgid('');print $mot->msgstr($msgid, 3);
Inheritance
Log::Report::Lexicon::MOTcompactis a Log::Report::Lexicon::Table
Overview
This module is translating, based on MO files (binary versions of the PO files, the "Machine Object" format)
Actually, this module is not "compact" anymore: not trading off speed for memory. That may change again in the future.
To get a MO file, you first need a PO file. Then run msgfmt, which is part of the gnu gettext package.
msgfmt -cv -o $domain.mo $domain.po# -c = --check-format & --check-header & --check-domain# -v = --verbose# -o = --output-file
Extends "DESCRIPTION" in Log::Report::Lexicon::Table.
Methods
Extends "METHODS" in Log::Report::Lexicon::Table.
Constructors
Extends "Constructors" in Log::Report::Lexicon::Table.
- Log::Report::Lexicon::MOTcompact->
new(%options) -
Inherited, see "Constructors" in Log::Report::Lexicon::Table
- Log::Report::Lexicon::MOTcompact->
read($filename, %options) -
Read the MOT table information from
$filename.-Option --Defaultcharset <from header>- charset => STRING
-
The character-set which is used for the file. When not specified, it is taken from the "Content-Type" field in the PO-file.
Attributes
Extends "Attributes" in Log::Report::Lexicon::Table.
- $obj->
filename() -
Returns the name of the source file for this data.
- $obj->
index() -
Returns a HASH of all defined PO objects, organized by msgid. Please try to avoid using this: use
msgid()for lookup.
- $obj->
originalCharset() -
Returns the character-set as found in the PO-file. The strings are converted into utf8 before you use them in the program.
Managing PO's
Extends "Managing PO's" in Log::Report::Lexicon::Table.
Translation
Extends "Translation" in Log::Report::Lexicon::Table.
- $obj->
msgid( STRING, [$msgctxt] ) -
Lookup the translations with the STRING. Returns a SCALAR, when only one translation is known, and an ARRAY when we have plural forms. Returns
"undef"when the translation is not defined.
- $obj->
msgstr( $msgid, [$count, $msgctxt] ) -
Returns the translated string for
$msgid. When not specified,$countis 1 (the singular form).
Administration
Extends "Administration" in Log::Report::Lexicon::Table.
$obj->
|
Inherited, see "Administration" in Log::Report::Lexicon::Table |
|---|---|
$obj->
|
Inherited, see "Administration" in Log::Report::Lexicon::Table |
$obj->
|
Inherited, see "Administration" in Log::Report::Lexicon::Table |
$obj->
|
Inherited, see "Administration" in Log::Report::Lexicon::Table |
$obj->
|
Inherited, see "Administration" in Log::Report::Lexicon::Table |
$obj->
|
Inherited, see "Administration" in Log::Report::Lexicon::Table |
Diagnostics
- Error: only acceptable parameter is 'ACTIVE'
Releases
6 releases since Debian 8 (Jessie); the text changed 4 times.