Scroll to navigation

Log::Report::Template::Textdomain(3pm) User Contributed Perl Documentation Log::Report::Template::Textdomain(3pm)

NAME

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

INHERITANCE

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

SYNOPSIS

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

DESCRIPTION

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

METHODS

Constructors

$class->new(%options)

 -Option              --Default
  lang                  undef
  lexicon               undef
  only_in_directory     undef
  templater             <required>
  translation_function  'loc'
    
[1.01] Initial language to translate to. Usually, this language which change for each user connection via translateTo().
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.
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.
$class->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

$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->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->templater()
The Log::Report::Template object which is using this textdomain.

Translating

$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.

DIAGNOSTICS

Cast by upgrade()
Cast by translationFunction()
Cast by translationFunction()
Cast by translationFunction()
Cast by translationFunction()
Cast by translationFunction()

SEE ALSO

This module is part of Log-Report-Template version 1.03, built on September 08, 2025. Website: http://perl.overmeer.net/CPAN/

LICENSE

For contributors see file ChangeLog.

This software is copyright (c) 2017-2025 by Mark Overmeer.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2025-10-04 perl v5.40.1