1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
=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')
or die;
my $header = $mot->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)
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 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
Extends L<"DESCRIPTION" in Log::Report::Lexicon::Table|Log::Report::Lexicon::Table/"DESCRIPTION">.
=head1 METHODS
Extends L<"METHODS" in Log::Report::Lexicon::Table|Log::Report::Lexicon::Table/"METHODS">.
=head2 Constructors
Extends L<"Constructors" in Log::Report::Lexicon::Table|Log::Report::Lexicon::Table/"Constructors">.
=over 4
=item Log::Report::Lexicon::MOTcompact-E<gt>B<new>(%options)
Inherited, 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 <from header>
=over 2
=item 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.
=back
=back
=head2 Attributes
Extends L<"Attributes" in Log::Report::Lexicon::Table|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.
=item $obj-E<gt>B<originalCharset>()
Returns the character-set as found in the PO-file. The strings are
converted into utf8 before you use them in the program.
=back
=head2 Managing PO's
Extends L<"Managing PO's" in Log::Report::Lexicon::Table|Log::Report::Lexicon::Table/"Managing PO's">.
=head3 Translation
Extends L<"Translation" in Log::Report::Lexicon::Table|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
Extends L<"Administration" in Log::Report::Lexicon::Table|Log::Report::Lexicon::Table/"Administration">.
=over 4
=item $obj-E<gt>B<add>($po)
Inherited, see L<Log::Report::Lexicon::Table/"Administration">
=item $obj-E<gt>B<header>($field)
Inherited, see L<Log::Report::Lexicon::Table/"Administration">
=item $obj-E<gt>B<nrPlurals>()
Inherited, see L<Log::Report::Lexicon::Table/"Administration">
=item $obj-E<gt>B<pluralIndex>($count)
Inherited, see L<Log::Report::Lexicon::Table/"Administration">
=item $obj-E<gt>B<setupPluralAlgorithm>()
Inherited, see L<Log::Report::Lexicon::Table/"Administration">
=item $obj-E<gt>B<translations>( [$active] )
Inherited, 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.12,
built on April 18, 2025. Website: F<http://perl.overmeer.net/CPAN/>
=head1 LICENSE
Copyrights 2007-2025 by [Mark Overmeer <markov@cpan.org>]. 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://dev.perl.org/licenses/>
|