line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::TextDomain::OO::Plugin::Expand::Gettext; ## no critic (TidyCode)
|
2
|
|
|
|
|
|
|
|
3
|
17
|
|
|
17
|
|
14405
|
use strict;
|
|
17
|
|
|
|
|
41
|
|
|
17
|
|
|
|
|
545
|
|
4
|
17
|
|
|
17
|
|
119
|
use warnings;
|
|
17
|
|
|
|
|
34
|
|
|
17
|
|
|
|
|
474
|
|
5
|
17
|
|
|
17
|
|
4921
|
use Locale::Utils::PlaceholderNamed;
|
|
17
|
|
|
|
|
67584
|
|
|
17
|
|
|
|
|
408
|
|
6
|
17
|
|
|
17
|
|
105
|
use Moo::Role;
|
|
17
|
|
|
|
|
42
|
|
|
17
|
|
|
|
|
87
|
|
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
|
|
12683
|
my ($self, $msgid, @args) = @_;
|
25
|
|
|
|
|
|
|
|
26
|
31
|
|
|
|
|
126
|
my $translation = $self->translate(undef, $msgid);
|
27
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
28
|
|
|
|
|
|
|
$translation,
|
29
|
31
|
50
|
|
|
|
229
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
30
|
|
|
|
|
|
|
);
|
31
|
31
|
50
|
|
|
|
1510
|
$self->filter
|
32
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
33
|
|
|
|
|
|
|
|
34
|
31
|
|
|
|
|
352
|
return $translation;
|
35
|
|
|
|
|
|
|
}
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub __nx {
|
38
|
19
|
|
|
19
|
|
5689
|
my ($self, $msgid, $msgid_plural, $count, @args) = @_;
|
39
|
|
|
|
|
|
|
|
40
|
19
|
|
|
|
|
66
|
my $translation = $self->translate(undef, $msgid, $msgid_plural, $count, 1);
|
41
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
42
|
|
|
|
|
|
|
$translation,
|
43
|
19
|
50
|
|
|
|
110
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
44
|
|
|
|
|
|
|
);
|
45
|
19
|
50
|
|
|
|
2160
|
$self->filter
|
46
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
47
|
|
|
|
|
|
|
|
48
|
19
|
|
|
|
|
266
|
return $translation;
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub __px {
|
52
|
7
|
|
|
7
|
|
30
|
my ($self, $msgctxt, $msgid, @args) = @_;
|
53
|
|
|
|
|
|
|
|
54
|
7
|
|
|
|
|
29
|
my $translation = $self->translate($msgctxt, $msgid);
|
55
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
56
|
|
|
|
|
|
|
$translation,
|
57
|
7
|
50
|
|
|
|
37
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
58
|
|
|
|
|
|
|
);
|
59
|
7
|
50
|
|
|
|
214
|
$self->filter
|
60
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
61
|
|
|
|
|
|
|
|
62
|
7
|
|
|
|
|
76
|
return $translation;
|
63
|
|
|
|
|
|
|
}
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub __npx { ## no critic (ManyArgs)
|
66
|
16
|
|
|
16
|
|
57
|
my ($self, $msgctxt, $msgid, $msgid_plural, $count, @args) = @_;
|
67
|
|
|
|
|
|
|
|
68
|
16
|
|
|
|
|
58
|
my $translation = $self->translate($msgctxt, $msgid, $msgid_plural, $count, 1);
|
69
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext->expand_named(
|
70
|
|
|
|
|
|
|
$translation,
|
71
|
16
|
50
|
|
|
|
108
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
72
|
|
|
|
|
|
|
);
|
73
|
16
|
50
|
|
|
|
1565
|
$self->filter
|
74
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
75
|
|
|
|
|
|
|
|
76
|
16
|
|
|
|
|
163
|
return $translation;
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
BEGIN {
|
80
|
17
|
|
|
17
|
|
12600
|
no warnings qw(redefine); ## no critic (NoWarnings)
|
|
17
|
|
|
|
|
48
|
|
|
17
|
|
|
|
|
2534
|
|
81
|
17
|
|
|
17
|
|
94
|
*__ = \&__x;
|
82
|
17
|
|
|
|
|
58
|
*__n = \&__nx;
|
83
|
17
|
|
|
|
|
41
|
*__p = \&__px;
|
84
|
17
|
|
|
|
|
35
|
*__np = \&__npx;
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Dummy methods for string marking.
|
87
|
|
|
|
|
|
|
my $dummy = sub {
|
88
|
16
|
|
|
16
|
|
2835
|
my (undef, @more) = @_;
|
89
|
16
|
100
|
|
|
|
111
|
return wantarray ? @more : $more[0];
|
90
|
17
|
|
|
|
|
75
|
};
|
91
|
17
|
|
|
|
|
124
|
*N__ = $dummy;
|
92
|
17
|
|
|
|
|
34
|
*N__x = $dummy;
|
93
|
17
|
|
|
|
|
32
|
*N__n = $dummy;
|
94
|
17
|
|
|
|
|
30
|
*N__nx = $dummy;
|
95
|
17
|
|
|
|
|
38
|
*N__p = $dummy;
|
96
|
17
|
|
|
|
|
39
|
*N__px = $dummy;
|
97
|
17
|
|
|
|
|
37
|
*N__np = $dummy;
|
98
|
17
|
|
|
|
|
475
|
*N__npx = $dummy;
|
99
|
|
|
|
|
|
|
}
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1;
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__
|