NAME

Log::Report::Template::Textdomain - template translation with one domain

INHERITANCE

Log::Report::Template::Textdomain
  is a Log::Report::Domain
  is a Log::Report::Minimal::Domain

SYNOPSIS

my $templater = Log::Report::Template->new(...);
my $domain    = $templater->addTextdomain(%options);

DESCRIPTION

Manage one translation domain for Log::Report::Template.

Extends "DESCRIPTION" in Log::Report::Domain.

METHODS

Extends "METHODS" in Log::Report::Domain.

Constructors

Extends "Constructors" in Log::Report::Domain.

Log::Report::Template::Textdomain->new(%options)
-Option              --Defined in                  --Default
 lang                                                undef
 lexicon                                             undef
 name                  Log::Report::Minimal::Domain  <required>
 only_in_directory                                   undef
 templater                                           <required>
 translation_function                                'loc'
lang => LANGUAGES

[1.01] Initial language to translate to. Usually, this language which change for each user connection via translateTo().

lexicon => DIRECTORY
name => STRING
only_in_directory => DIRECTORY|ARRAY

The textdomain can only be used in the indicated directories: if found anywhere else, it's an error. When not specified, the function is allowed everywhere.

templater => Log::Report::Template-object
translation_function => STRING

The name of the function as used in the template to call for translation. See function(). It must be unique over all text-domains used.

Log::Report::Template::Textdomain->upgrade($domain, %options)

Upgrade a base class Log::Report::Domain-object into an Template domain.

This is a bit akward process, needed when one of the code packages uses the same domain as the templating system uses. The generic domain configuration stays intact.

Attributes

Extends "Attributes" in Log::Report::Domain.

$obj->configure(%options)

Inherited, see "Attributes" in Log::Report::Domain

$obj->contextRules()

Inherited, see "Attributes" in Log::Report::Domain

$obj->expectedIn($filename)

Return true when the function name which relates to this domain is allowed to be used for the indicated file. The msgid extractor will warn when there is no match.

$obj->function()

Returns the name of the function which is used for translations.

$obj->isConfigured()

Inherited, see "Attributes" in Log::Report::Minimal::Domain

$obj->lang()

The language we are going to translate to. Change this with translateTo() for this domain, or better Log::Report::Template::translateTo().

$obj->lexicon()

Directory where the translation tables are kept.

$obj->name()

Inherited, see "Attributes" in Log::Report::Minimal::Domain

$obj->nativeLanguage()

Inherited, see "Attributes" in Log::Report::Domain

$obj->readConfig($filename)
Log::Report::Template::Textdomain->readConfig($filename)

Inherited, see "Attributes" in Log::Report::Domain

$obj->templater()

The Log::Report::Template object which is using this textdomain.

$obj->translator()

Inherited, see "Attributes" in Log::Report::Domain

Translating

Extends "Translating" in Log::Report::Domain.

$obj->defaultContext()

Inherited, see "Translating" in Log::Report::Domain

$obj->interpolate( $msgid, [$args] )

Inherited, see "Translating" in Log::Report::Minimal::Domain

$obj->setContext(STRING|HASH|ARRAY|PAIRS)

Inherited, see "Translating" in Log::Report::Domain

$obj->translate($message, $language)

Inherited, see "Translating" in Log::Report::Domain

$obj->translateTo($lang)

Set the language to translate to for $lang, for this domain only. This may be useful when various text domains do not support the same destination languages. But in general, you can best use Log::Report::Template::translateTo().

$obj->translationFunction()

This method returns a CODE which is able to handle a call for translation by Template Toolkit.

$obj->updateContext(STRING|HASH|ARRAY|PAIRS)

Inherited, see "Translating" in Log::Report::Domain

DETAILS

Extends "DETAILS" in Log::Report::Domain.

SEE ALSO

This module is part of Log-Report-Template distribution version 1.02, built on July 29, 2025. Website: http://perl.overmeer.net/CPAN/

LICENSE

Copyrights 2017-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 http://dev.perl.org/licenses/