Returns a new object which copies info from original, and updates it with the specified OPTIONS and VARIABLES. The advantage is that the cached translations are shared between the objects.
my $s = __x "found {nr} files", nr => 5; my $t = $s->clone(nr => 3); my $t = $s->(nr => 3); # equivalent print $s; # found 5 files print $t; # found 3 files
Option | Default |
---|---|
_append |
|
_category |
|
_class | [] |
_classes | [] |
_count |
|
_domain | from |
_expand |
|
_msgid |
|
_plural |
|
_prepend |
|
Returns the string or Log::Report::Message object which is appended
after this one. Usually undef
.
Returns the LIST of classes which are defined for this message; message group indicators, as often found in exception-based programming.
Returns the count, which is used to select the translation alternatives.
Returns the domain of the first translatable string in the structure.
Returns the msgid which will later be translated.
Returns the string which is prepended to this one. Usually undef
.
Lookup the named PARAMETER for the message. All pre-defined names have their own method, and should be used with preference.
When the message was produced with
my @files = qw/one two three/; my $msg = __xn "found one file: {files}" , "found {_count} files: {files}" , scalar @files, files => \@files , _class => 'IO, files';
then the values can be takes from the produced message as
my $files = $msg->valueOf('files'); # returns ARRAY reference print @$files; # 3 my $count = $msg->count; # 3 my @class = $msg->classes; # 'IO', 'files' if($msg->inClass('files')) # true
This method implements the overloading of concatenation, which is needed
to delay translations even longer. When PREPEND is true, the STRING
or OBJECT (other Log::Report::Message
) needs to prepended, otherwise
it is appended.
print __"Hello" . ' ' . __"World!"; print __("Hello")->concat(' ')->concat(__"World!")->concat("\n");
Returns true if the message is in the specified CLASS (string) or matches the REGEX. The trueth value is the (first matching) class.
Translate a message. If not specified, the default locale is used.
Return the concatenation of the prepend, msgid, and append strings. Variable expansions within the msgid is not performed.