=encoding utf8

=head1 NAME

Log::Report::Lexicon::MOTcompact - use translations from an MO file

=head1 INHERITANCE

 Log::Report::Lexicon::MOTcompact
   is a Log::Report::Lexicon::Table

=head1 SYNOPSIS

 # using a MO table efficiently
 my $mot = Log::Report::Lexicon::MOTcompact
             ->read('mo/nl.mo', charset => 'utf-8')
    or die;

 my $header = $pot->msgid('');
 print $mot->msgstr($msgid, 3);

=head1 DESCRIPTION

This module is translating, based on MO files (binary versions of
the PO files, the "Machine Object" format)

Internally, this module tries to be as efficient as possible: high
speed and low memory foot-print.  You will not be able to sub-class
this class cleanly.

To get a MO file, you first need a PO file.  Then run F<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

See L<documentation in the base class|Log::Report::Lexicon::Table/"DESCRIPTION">.
 
=head1 METHODS

See L<documentation in the base class|Log::Report::Lexicon::Table/"METHODS">.
 
=head2 Constructors

See L<documentation in the base class|Log::Report::Lexicon::Table/"Constructors">.
 
=over 4

=item Log::Report::Lexicon::MOTcompact-E<gt>B<new>(OPTIONS)

See L<Log::Report::Lexicon::Table/"Constructors">

=item Log::Report::Lexicon::MOTcompact-E<gt>B<read>(FILENAME, OPTIONS)

Read the MOT table information from FILENAME.

 -Option  --Default
  charset   <required>
  take_all  <true>

=over 2

=item charset => STRING

The character-set which is used for the file.  You must specify
this explicitly, while it cannot be trustfully detected automatically.

=item take_all => BOOLEAN

This will cause the whole translation table to be read at once.  If
false, a file-handle will be kept open and translations read on demand.
That may (but very well may not) save a memory foot-print, especially
when the strings are large.

=back

=back

=head2 Attributes

See L<documentation in the base class|Log::Report::Lexicon::Table/"Attributes">.
 
=over 4

=item $obj-E<gt>B<filename>()

Returns the name of the source file for this data.

=item $obj-E<gt>B<index>()

Returns a HASH of all defined PO objects, organized by msgid.  Please try
to avoid using this: use L<msgid()|Log::Report::Lexicon::MOTcompact/"Managing PO's"> for lookup.

=back

=head2 Managing PO's

See L<documentation in the base class|Log::Report::Lexicon::Table/"Managing PO's">.
 
=head3 Translation

See L<documentation in the base class|Log::Report::Lexicon::Table/"Translation">.
 
=over 4

=item $obj-E<gt>B<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 C<undef> when the translation is not defined.

=item $obj-E<gt>B<msgstr>(MSGID, [COUNT, MSGCTXT])

Returns the translated string for MSGID.  When not specified, COUNT is 1
(the singular form).

=back

=head3 Administration

See L<documentation in the base class|Log::Report::Lexicon::Table/"Administration">.
 
=over 4

=item $obj-E<gt>B<add>(PO)

See L<Log::Report::Lexicon::Table/"Administration">

=item $obj-E<gt>B<header>(FIELD)

See L<Log::Report::Lexicon::Table/"Administration">

=item $obj-E<gt>B<nrPlurals>()

See L<Log::Report::Lexicon::Table/"Administration">

=item $obj-E<gt>B<pluralIndex>(COUNT)

See L<Log::Report::Lexicon::Table/"Administration">

=item $obj-E<gt>B<setupPluralAlgorithm>()

See L<Log::Report::Lexicon::Table/"Administration">

=item $obj-E<gt>B<translations>([ACTIVE])

See L<Log::Report::Lexicon::Table/"Administration">

=back

=head1 DIAGNOSTICS

=over 4

=item Error: only acceptable parameter is 'ACTIVE'

=back

=head1 SEE ALSO

This module is part of Log-Report-Lexicon distribution version 1.01,
built on January 06, 2014. Website: F<http://perl.overmeer.net/log-report/>

=head1 LICENSE

Copyrights 2007-2014 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

