line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::TextDomain::OO::Plugin::Expand::Gettext::Loc; ## no critic (TidyCode)
|
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
7520
|
use strict;
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
159
|
|
4
|
6
|
|
|
6
|
|
47
|
use warnings;
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
138
|
|
5
|
6
|
|
|
6
|
|
906
|
use Locale::Utils::PlaceholderNamed;
|
|
6
|
|
|
|
|
10074
|
|
|
6
|
|
|
|
|
120
|
|
6
|
6
|
|
|
6
|
|
32
|
use Moo::Role;
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
29
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.027';
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
requires qw(
|
11
|
|
|
|
|
|
|
translate
|
12
|
|
|
|
|
|
|
filter
|
13
|
|
|
|
|
|
|
run_filter
|
14
|
|
|
|
|
|
|
);
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has expand_gettext_loc => (
|
17
|
|
|
|
|
|
|
is => 'rw',
|
18
|
|
|
|
|
|
|
default => sub {
|
19
|
|
|
|
|
|
|
return Locale::Utils::PlaceholderNamed->new;
|
20
|
|
|
|
|
|
|
},
|
21
|
|
|
|
|
|
|
);
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub loc_x {
|
24
|
8
|
|
|
8
|
1
|
1927
|
my ($self, $msgid, @args) = @_;
|
25
|
|
|
|
|
|
|
|
26
|
8
|
|
|
|
|
39
|
my $translation = $self->translate(undef, $msgid);
|
27
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext_loc->expand_named(
|
28
|
|
|
|
|
|
|
$translation,
|
29
|
8
|
50
|
|
|
|
126
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
30
|
|
|
|
|
|
|
);
|
31
|
8
|
50
|
|
|
|
346
|
$self->filter
|
32
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
33
|
|
|
|
|
|
|
|
34
|
8
|
|
|
|
|
93
|
return $translation;
|
35
|
|
|
|
|
|
|
}
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub loc_nx {
|
38
|
4
|
|
|
4
|
1
|
15
|
my ($self, $msgid, $msgid_plural, $count, @args) = @_;
|
39
|
|
|
|
|
|
|
|
40
|
4
|
|
|
|
|
14
|
my $translation = $self->translate(undef, $msgid, $msgid_plural, $count, 1);
|
41
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext_loc->expand_named(
|
42
|
|
|
|
|
|
|
$translation,
|
43
|
4
|
50
|
|
|
|
24
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
44
|
|
|
|
|
|
|
);
|
45
|
4
|
50
|
|
|
|
230
|
$self->filter
|
46
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
47
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
43
|
return $translation;
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub loc_px {
|
52
|
5
|
|
|
5
|
1
|
23
|
my ($self, $msgctxt, $msgid, @args) = @_;
|
53
|
|
|
|
|
|
|
|
54
|
5
|
|
|
|
|
19
|
my $translation = $self->translate($msgctxt, $msgid);
|
55
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext_loc->expand_named(
|
56
|
|
|
|
|
|
|
$translation,
|
57
|
5
|
50
|
|
|
|
25
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
58
|
|
|
|
|
|
|
);
|
59
|
5
|
50
|
|
|
|
172
|
$self->filter
|
60
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
61
|
|
|
|
|
|
|
|
62
|
5
|
|
|
|
|
51
|
return $translation;
|
63
|
|
|
|
|
|
|
}
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub loc_npx { ## no critic (ManyArgs)
|
66
|
4
|
|
|
4
|
1
|
14
|
my ($self, $msgctxt, $msgid, $msgid_plural, $count, @args) = @_;
|
67
|
|
|
|
|
|
|
|
68
|
4
|
|
|
|
|
14
|
my $translation = $self->translate($msgctxt, $msgid, $msgid_plural, $count, 1);
|
69
|
|
|
|
|
|
|
@args and $translation = $self->expand_gettext_loc->expand_named(
|
70
|
|
|
|
|
|
|
$translation,
|
71
|
4
|
50
|
|
|
|
22
|
@args == 1 ? %{ $args[0] } : @args,
|
|
0
|
100
|
|
|
|
0
|
|
72
|
|
|
|
|
|
|
);
|
73
|
4
|
50
|
|
|
|
224
|
$self->filter
|
74
|
|
|
|
|
|
|
and $self->run_filter(\$translation);
|
75
|
|
|
|
|
|
|
|
76
|
4
|
|
|
|
|
41
|
return $translation;
|
77
|
|
|
|
|
|
|
}
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
BEGIN {
|
80
|
6
|
|
|
6
|
|
4080
|
no warnings qw(redefine); ## no critic (NoWarnings)
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
906
|
|
81
|
6
|
|
|
6
|
|
33
|
*loc_ = \&loc_x;
|
82
|
6
|
|
|
|
|
17
|
*loc_n = \&loc_nx;
|
83
|
6
|
|
|
|
|
13
|
*loc_p = \&loc_px;
|
84
|
6
|
|
|
|
|
11
|
*loc_np = \&loc_npx;
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# Dummy methods for string marking.
|
87
|
|
|
|
|
|
|
my $dummy = sub {
|
88
|
9
|
|
|
9
|
|
1516
|
my (undef, @more) = @_;
|
89
|
9
|
100
|
|
|
|
61
|
return wantarray ? @more : $more[0];
|
90
|
6
|
|
|
|
|
20
|
};
|
91
|
6
|
|
|
|
|
13
|
*Nloc_ = $dummy;
|
92
|
6
|
|
|
|
|
9
|
*Nloc_x = $dummy;
|
93
|
6
|
|
|
|
|
17
|
*Nloc_n = $dummy;
|
94
|
6
|
|
|
|
|
12
|
*Nloc_nx = $dummy;
|
95
|
6
|
|
|
|
|
23
|
*Nloc_p = $dummy;
|
96
|
6
|
|
|
|
|
12
|
*Nloc_px = $dummy;
|
97
|
6
|
|
|
|
|
11
|
*Nloc_np = $dummy;
|
98
|
6
|
|
|
|
|
159
|
*Nloc_npx = $dummy;
|
99
|
|
|
|
|
|
|
}
|
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1;
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__
|