METHODS

Constructors

$class->new( %options )

Create a new Domain object.

Option Defined in Default

name

Log::Report::Minimal::Domain

<required>

name => STRING

Attributes

$obj->configure( %options )

The import is automatically called when the package is compiled. For all but one packages in your distribution, it will only contain the name of the DOMAIN. For one package, it will contain configuration information. These %options are used for all packages which use the same DOMAIN. See chapter Configuring below.

Option Defined in Default

config

undef

context_rules

undef

formatter

PRINTI

native_language

'en_US'

translator

created internally

where

Log::Report::Minimal::Domain

<required>

config => FILENAME
Read the settings from the file. The parameters found in the file are used as default for the parameters above. This parameter is especially useful for the context_rules, which need to be shared between the running application and xgettext-perl. See readConfig()
context_rules => HASH|OBJECT
When rules are provided, the translator will use the msgctxt fields as provided by PO-files (gettext). This parameter is used to initialize a Log::Report::Translator::Context helper object.
formatter => CODE|HASH|'PRINTI'
Selects the formatter used for the errors messages. The default is PRINTI, which will use String::Print::printi(): interpolation with curly braces around the variable names.
native_language => CODESET
This is the language which you have used to write the translatable and the non-translatable messages in. In case no translation is needed, you still wish the system error messages to be in the same language as the report. Of course, each textdomain can define its own.
translator => Log::Report::Translator|HASH
Set the object which will do the translations for this domain.
where => ARRAY
$obj->contextRules
$obj->defaultContext

Returns the current default translation context settings as HASH. You should not modify the content of that HASH: change it by called setContext() or updateContext().

$obj->isConfigured
See isConfigured in Log::Report::Minimal::Domain.
$obj->name
See name in Log::Report::Minimal::Domain.
$obj->nativeLanguage
$obj->readConfig( $filename )
$class->readConfig( $filename )

Helper method, which simply parses the content $filename into a HASH to be used as parameters to configure(). The filename must end on '.pl', to indicate that it uses perl syntax (can be processed with Perl's do command) or end on '.json'. See also chapter Configuring below.

Currently, this file can be in Perl native format (when ending on .pl) or JSON (when it ends with .json). Various modules may explain parts of what can be found in these files, for instance Log::Report::Translator::Context.

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

Temporary set the default translation context for messages. This is used when the message is created without a _context parameter. The context can be retrieved with defaultContext().

Contexts are totally ignored then there are no context_rules. When you do not wish to change settings, you may simply provide a HASH.

» Example:
   use Log::Report 'my-domain', context_rules => {};
$obj->translator
$obj->updateContext( STRING|HASH|ARRAY|PAIRS )

[1.10] Make changes and additions to the active context (see setContext()).

Action

$obj->interpolate( $msgid, [$args] )
See interpolate in Log::Report::Minimal::Domain.
$obj->translate( $message, $language )

Translate the $message into the $language.