| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Translate::Fluent::Elements::MessageReference; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
40
|
use Moo; |
|
|
6
|
|
|
|
|
13
|
|
|
|
6
|
|
|
|
|
34
|
|
|
4
|
|
|
|
|
|
|
extends 'Translate::Fluent::Elements::Base'; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has [qw( |
|
7
|
|
|
|
|
|
|
identifier |
|
8
|
|
|
|
|
|
|
attribute_accessor |
|
9
|
|
|
|
|
|
|
)] => ( |
|
10
|
|
|
|
|
|
|
is => 'ro', |
|
11
|
|
|
|
|
|
|
default => sub { undef }, |
|
12
|
|
|
|
|
|
|
); |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
around BUILDARGS => sub { |
|
15
|
|
|
|
|
|
|
my ($orig, $class, %args) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$args{identifier} = delete $args{ Identifier }; |
|
18
|
|
|
|
|
|
|
$args{attribute_accessor} = delete $args{ AttributeAccessor }; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$class->$orig( %args ); |
|
21
|
|
|
|
|
|
|
}; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub translate { |
|
24
|
6
|
|
|
6
|
1
|
14
|
my ($self, $variables) = @_; |
|
25
|
|
|
|
|
|
|
|
|
26
|
6
|
|
|
|
|
20
|
my $message = $variables->{__resourceset}->get_message( $self->identifier ); |
|
27
|
6
|
50
|
|
|
|
14
|
return unless $message; |
|
28
|
|
|
|
|
|
|
|
|
29
|
6
|
100
|
|
|
|
16
|
if ($self->attribute_accessor) { |
|
30
|
4
|
|
|
|
|
20
|
$message = $message->get_attribute_resource( |
|
31
|
|
|
|
|
|
|
$self->attribute_accessor->identifier |
|
32
|
|
|
|
|
|
|
); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
6
|
50
|
|
|
|
13
|
return unless $message; |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# Not sure if this should be called with no variables |
|
38
|
|
|
|
|
|
|
# or with the variables the parent was called with |
|
39
|
|
|
|
|
|
|
# so going with the later for now. |
|
40
|
6
|
|
|
|
|
19
|
return $message->translate( $variables ); |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
|
44
|
|
|
|
|
|
|
__END__ |