=encoding utf8

=head1 NAME

Log::Report::Translator::POT - translation based on POT files

=head1 INHERITANCE

 Log::Report::Translator::POT
   is a Log::Report::Translator

=head1 SYNOPSIS

 # internal use
 my $msg = Log::Report::Message->new
   ( _msgid  => "Hello World\n"
   , _domain => 'my-domain'
   );

 print Log::Report::Translator::POT
    ->new(lexicons => $dir)
    ->translate($msg, 'nl-BE');

 # normal use (end-users view in the program's ::main)
 textdomain 'my-domain'
   , translator =>  Log::Report::Translator::POT->new(lexicon => $dir);
 print __"Hello World\n";

=head1 DESCRIPTION

Translate a message by directly accessing POT files.  The files will load
lazily (unless forced).  This module accesses the PO's in a compact way,
using L<Log::Report::Lexicon::POTcompact|Log::Report::Lexicon::POTcompact>, which is much more efficient
than L<Log::Report::Lexicon::PO|Log::Report::Lexicon::PO>.

Extends L<"DESCRIPTION" in Log::Report::Translator|Log::Report::Translator/"DESCRIPTION">.
 
=head1 METHODS

Extends L<"METHODS" in Log::Report::Translator|Log::Report::Translator/"METHODS">.
 
=head2 Constructors

Extends L<"Constructors" in Log::Report::Translator|Log::Report::Translator/"Constructors">.
 
=over 4

=item Log::Report::Translator::POT-E<gt>B<new>(%options)

 -Option  --Default
  charset   <undef>
  lexicons  <see text>

=over 2

=item charset => STRING

Enforce character set for files.  We default to reading the character-set
as defined in the header of each PO file.

=item lexicons => DIRECTORY

The DIRECTORY where the translations can be found.  See
L<Log::Report::Lexicon::Index|Log::Report::Lexicon::Index> for the expected structure of such
DIRECTORY.

The default is based on the location of the module which instantiates
this translator.  The filename of the module is stripped from its C<.pm>
extension, and used as directory name.  Within that directory, there
must be a directory named C<messages>, which will be the root directory
of a L<Log::Report::Lexicon::Index|Log::Report::Lexicon::Index>.

=back

example: default lexicon directory

 # file xxx/perl5.8.8/My/Module.pm
 use Log::Report 'my-domain'
   , translator => Log::Report::Translator::POT->new;

 # lexicon now in xxx/perl5.8.8/My/Module/messages/

=back

=head2 Accessors

Extends L<"Accessors" in Log::Report::Translator|Log::Report::Translator/"Accessors">.
 
=over 4

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

Returns the default charset, which can be overrule by the locale.

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

Returns a list of L<Log::Report::Lexicon::Index|Log::Report::Lexicon::Index> objects, where the
translation files may be located.

=back

=head2 Translating

Extends L<"Translating" in Log::Report::Translator|Log::Report::Translator/"Translating">.
 
=over 4

=item $obj-E<gt>B<load>($domain, $locale)

Inherited, see L<Log::Report::Translator/"Translating">

=item $obj-E<gt>B<translate>( $message, [$language, $ctxt] )

Inherited, see L<Log::Report::Translator/"Translating">

=back

=head1 SEE ALSO

This module is part of Log-Report-Lexicon distribution version 1.13,
built on May 06, 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/>

