line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::TextDomain::OO::Plugin::Expand::Gettext; ## no critic (TidyCode)
|
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
16414
|
use strict;
|
|
17
|
|
|
|
|
43
|
|
|
17
|
|
|
|
|
1091
|
|
4
|
17
|
|
|
17
|
|
129
|
use warnings;
|
|
17
|
|
|
|
|
45
|
|
|
17
|
|
|
|
|
482
|
|
5
|
17
|
|
|
17
|
|
5538
|
use Locale::Utils::PlaceholderNamed;
|
|
17
|
|
|
|
|
67709
|
|
|
17
|
|
|
|
|
500
|
|
6
|
17
|
|
|
17
|
|
108
|
use Moo::Role;
|
|
17
|
|
|
|
|
49
|
|
|
17
|
|
|
|
|
92
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.027';
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires qw(
|
11
|
|
|
|
|
|
|
translate
|
12
|
|
|
|
|
|
|
filter
|
13
|
|
|
|
|
|
|
run_filter
|
14
|
|
|
|
|
|
|
);
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has expand_gettext => (
|
17
|
|
|
|
|
|
|
is => 'rw',
|
18
|
|
|
|
|
|
|
default => sub {
|
19
|
|
|
|
|
|
|
return Locale::Utils::PlaceholderNamed->new;
|
20
|
|
|
|
|
|
|
},
|
21
|
|
|
|
|
|
|
);
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub __x {
|
24
|
31
|
|
|
31
|
|
13703
|
my ($self, $msgid, @args) = @_;
|
25
|
|
|
|
|
|
|
|
26
|
31
|
|
|
|
|
145
|
my $translation = $self->translate(undef, $msgid);
|
27
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
28
|
|
|
|
|
|
|
$translation,
|
29
|
31
|
50
|
|
|
|
265
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
30
|
|
|
|
|
|
|
);
|
31
|
31
|
50
|
|
|
|
1488
|
$self->filter
|
32
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
33
|
|
|
|
|
|
|
|
34
|
31
|
|
|
|
|
395
|
return $translation;
|
35
|
|
|
|
|
|
|
}
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub __nx {
|
38
|
19
|
|
|
19
|
|
7219
|
my ($self, $msgid, $msgid_plural, $count, @args) = @_;
|
39
|
|
|
|
|
|
|
|
40
|
19
|
|
|
|
|
75
|
my $translation = $self->translate(undef, $msgid, $msgid_plural, $count, 1);
|
41
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
42
|
|
|
|
|
|
|
$translation,
|
43
|
19
|
50
|
|
|
|
140
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
44
|
|
|
|
|
|
|
);
|
45
|
19
|
50
|
|
|
|
2163
|
$self->filter
|
46
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
47
|
|
|
|
|
|
|
|
48
|
19
|
|
|
|
|
208
|
return $translation;
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub __px {
|
52
|
7
|
|
|
7
|
|
39
|
my ($self, $msgctxt, $msgid, @args) = @_;
|
53
|
|
|
|
|
|
|
|
54
|
7
|
|
|
|
|
67
|
my $translation = $self->translate($msgctxt, $msgid);
|
55
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
56
|
|
|
|
|
|
|
$translation,
|
57
|
7
|
50
|
|
|
|
39
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
58
|
|
|
|
|
|
|
);
|
59
|
7
|
50
|
|
|
|
220
|
$self->filter
|
60
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
61
|
|
|
|
|
|
|
|
62
|
7
|
|
|
|
|
86
|
return $translation;
|
63
|
|
|
|
|
|
|
}
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub __npx { ## no critic (ManyArgs)
|
66
|
16
|
|
|
16
|
|
62
|
my ($self, $msgctxt, $msgid, $msgid_plural, $count, @args) = @_;
|
67
|
|
|
|
|
|
|
|
68
|
16
|
|
|
|
|
60
|
my $translation = $self->translate($msgctxt, $msgid, $msgid_plural, $count, 1);
|
69
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
70
|
|
|
|
|
|
|
$translation,
|
71
|
16
|
50
|
|
|
|
130
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
72
|
|
|
|
|
|
|
);
|
73
|
16
|
50
|
|
|
|
1619
|
$self->filter
|
74
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
75
|
|
|
|
|
|
|
|
76
|
16
|
|
|
|
|
175
|
return $translation;
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
BEGIN {
|
80
|
17
|
|
|
17
|
|
13294
|
no warnings qw(redefine); ## no critic (NoWarnings)
|
|
17
|
|
|
|
|
42
|
|
|
17
|
|
|
|
|
2782
|
|
81
|
17
|
|
|
17
|
|
91
|
*__ = \&__x;
|
82
|
17
|
|
|
|
|
53
|
*__n = \&__nx;
|
83
|
17
|
|
|
|
|
51
|
*__p = \&__px;
|
84
|
17
|
|
|
|
|
41
|
*__np = \&__npx;
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Dummy methods for string marking.
|
87
|
|
|
|
|
|
|
my $dummy = sub {
|
88
|
16
|
|
|
16
|
|
1913
|
my (undef, @more) = @_;
|
89
|
16
|
100
|
|
|
|
113
|
return wantarray ? @more : $more[0];
|
90
|
17
|
|
|
|
|
76
|
};
|
91
|
17
|
|
|
|
|
44
|
*N__ = $dummy;
|
92
|
17
|
|
|
|
|
37
|
*N__x = $dummy;
|
93
|
17
|
|
|
|
|
40
|
*N__n = $dummy;
|
94
|
17
|
|
|
|
|
34
|
*N__nx = $dummy;
|
95
|
17
|
|
|
|
|
108
|
*N__p = $dummy;
|
96
|
17
|
|
|
|
|
51
|
*N__px = $dummy;
|
97
|
17
|
|
|
|
|
50
|
*N__np = $dummy;
|
98
|
17
|
|
|
|
|
525
|
*N__npx = $dummy;
|
99
|
|
|
|
|
|
|
}
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1;
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__
|