line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::TextDomain::OO::Plugin::Expand::Gettext; ## no critic (TidyCode)
|
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
16074
|
use strict;
|
|
17
|
|
|
|
|
52
|
|
|
17
|
|
|
|
|
527
|
|
4
|
17
|
|
|
17
|
|
116
|
use warnings;
|
|
17
|
|
|
|
|
50
|
|
|
17
|
|
|
|
|
478
|
|
5
|
17
|
|
|
17
|
|
5469
|
use Locale::Utils::PlaceholderNamed;
|
|
17
|
|
|
|
|
68298
|
|
|
17
|
|
|
|
|
518
|
|
6
|
17
|
|
|
17
|
|
120
|
use Moo::Role;
|
|
17
|
|
|
|
|
58
|
|
|
17
|
|
|
|
|
112
|
|
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
|
|
13632
|
my ($self, $msgid, @args) = @_;
|
25
|
|
|
|
|
|
|
|
26
|
31
|
|
|
|
|
136
|
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
|
|
|
|
1502
|
$self->filter
|
32
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
33
|
|
|
|
|
|
|
|
34
|
31
|
|
|
|
|
425
|
return $translation;
|
35
|
|
|
|
|
|
|
}
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub __nx {
|
38
|
19
|
|
|
19
|
|
6892
|
my ($self, $msgid, $msgid_plural, $count, @args) = @_;
|
39
|
|
|
|
|
|
|
|
40
|
19
|
|
|
|
|
73
|
my $translation = $self->translate(undef, $msgid, $msgid_plural, $count, 1);
|
41
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
42
|
|
|
|
|
|
|
$translation,
|
43
|
19
|
50
|
|
|
|
144
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
44
|
|
|
|
|
|
|
);
|
45
|
19
|
50
|
|
|
|
2195
|
$self->filter
|
46
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
47
|
|
|
|
|
|
|
|
48
|
19
|
|
|
|
|
211
|
return $translation;
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub __px {
|
52
|
7
|
|
|
7
|
|
38
|
my ($self, $msgctxt, $msgid, @args) = @_;
|
53
|
|
|
|
|
|
|
|
54
|
7
|
|
|
|
|
31
|
my $translation = $self->translate($msgctxt, $msgid);
|
55
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
56
|
|
|
|
|
|
|
$translation,
|
57
|
7
|
50
|
|
|
|
38
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
58
|
|
|
|
|
|
|
);
|
59
|
7
|
50
|
|
|
|
231
|
$self->filter
|
60
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
61
|
|
|
|
|
|
|
|
62
|
7
|
|
|
|
|
89
|
return $translation;
|
63
|
|
|
|
|
|
|
}
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub __npx { ## no critic (ManyArgs)
|
66
|
16
|
|
|
16
|
|
73
|
my ($self, $msgctxt, $msgid, $msgid_plural, $count, @args) = @_;
|
67
|
|
|
|
|
|
|
|
68
|
16
|
|
|
|
|
63
|
my $translation = $self->translate($msgctxt, $msgid, $msgid_plural, $count, 1);
|
69
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
70
|
|
|
|
|
|
|
$translation,
|
71
|
16
|
50
|
|
|
|
120
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
72
|
|
|
|
|
|
|
);
|
73
|
16
|
50
|
|
|
|
1746
|
$self->filter
|
74
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
75
|
|
|
|
|
|
|
|
76
|
16
|
|
|
|
|
190
|
return $translation;
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
BEGIN {
|
80
|
17
|
|
|
17
|
|
14193
|
no warnings qw(redefine); ## no critic (NoWarnings)
|
|
17
|
|
|
|
|
56
|
|
|
17
|
|
|
|
|
3454
|
|
81
|
17
|
|
|
17
|
|
104
|
*__ = \&__x;
|
82
|
17
|
|
|
|
|
60
|
*__n = \&__nx;
|
83
|
17
|
|
|
|
|
49
|
*__p = \&__px;
|
84
|
17
|
|
|
|
|
61
|
*__np = \&__npx;
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Dummy methods for string marking.
|
87
|
|
|
|
|
|
|
my $dummy = sub {
|
88
|
16
|
|
|
16
|
|
1866
|
my (undef, @more) = @_;
|
89
|
16
|
100
|
|
|
|
120
|
return wantarray ? @more : $more[0];
|
90
|
17
|
|
|
|
|
85
|
};
|
91
|
17
|
|
|
|
|
44
|
*N__ = $dummy;
|
92
|
17
|
|
|
|
|
48
|
*N__x = $dummy;
|
93
|
17
|
|
|
|
|
53
|
*N__n = $dummy;
|
94
|
17
|
|
|
|
|
44
|
*N__nx = $dummy;
|
95
|
17
|
|
|
|
|
35
|
*N__p = $dummy;
|
96
|
17
|
|
|
|
|
34
|
*N__px = $dummy;
|
97
|
17
|
|
|
|
|
42
|
*N__np = $dummy;
|
98
|
17
|
|
|
|
|
523
|
*N__npx = $dummy;
|
99
|
|
|
|
|
|
|
}
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1;
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__
|