line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::TextDomain::OO::Plugin::Language::LanguageOfLanguages; ## no critic (Tidy Code)
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4164
|
use strict;
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
62
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings;
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
58
|
|
5
|
2
|
|
|
2
|
|
14
|
use Locale::TextDomain::OO::Singleton::Lexicon;
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
55
|
|
6
|
2
|
|
|
2
|
|
12
|
use Locale::TextDomain::OO::Util::JoinSplitLexiconKeys;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
41
|
|
7
|
2
|
|
|
2
|
|
10
|
use Moo::Role;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
15
|
|
8
|
2
|
|
|
2
|
|
781
|
use MooX::Types::MooseLike::Base qw(Str ArrayRef);
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
126
|
|
9
|
2
|
|
|
2
|
|
78
|
use namespace::autoclean;
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
15
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.014';
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
with qw(
|
14
|
|
|
|
|
|
|
Locale::TextDomain::OO::Role::Logger
|
15
|
|
|
|
|
|
|
);
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
requires qw(
|
18
|
|
|
|
|
|
|
language
|
19
|
|
|
|
|
|
|
category
|
20
|
|
|
|
|
|
|
domain
|
21
|
|
|
|
|
|
|
project
|
22
|
|
|
|
|
|
|
);
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has languages => (
|
25
|
|
|
|
|
|
|
is => 'rw',
|
26
|
|
|
|
|
|
|
isa => ArrayRef[Str],
|
27
|
|
|
|
|
|
|
trigger => 1,
|
28
|
|
|
|
|
|
|
lazy => 1,
|
29
|
|
|
|
|
|
|
default => sub { [] },
|
30
|
|
|
|
|
|
|
);
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _trigger_languages { ## no critic (UnusedPrivateSubroutines)
|
33
|
2
|
|
|
2
|
|
4089
|
my ($self, $languages) = @_;
|
34
|
|
|
|
|
|
|
|
35
|
2
|
|
|
|
|
10
|
my $lexicon = Locale::TextDomain::OO::Singleton::Lexicon->instance->data;
|
36
|
2
|
|
|
|
|
21
|
for my $language ( @{$languages} ) {
|
|
2
|
|
|
|
|
6
|
|
37
|
7
|
|
|
|
|
14
|
for my $key ( keys %{$lexicon} ) {
|
|
7
|
|
|
|
|
18
|
|
38
|
9
|
|
|
|
|
29
|
my $lexicon_key = Locale::TextDomain::OO::Util::JoinSplitLexiconKeys
|
39
|
|
|
|
|
|
|
->instance
|
40
|
|
|
|
|
|
|
->join_lexicon_key({
|
41
|
|
|
|
|
|
|
language => lc $language,
|
42
|
|
|
|
|
|
|
category => $self->category,
|
43
|
|
|
|
|
|
|
domain => $self->domain,
|
44
|
|
|
|
|
|
|
project => $self->project,
|
45
|
|
|
|
|
|
|
});
|
46
|
9
|
100
|
|
|
|
660
|
if ( $key eq $lexicon_key ) {
|
47
|
2
|
|
|
|
|
38
|
$self->language( lc $language );
|
48
|
2
|
|
|
|
|
107
|
return;
|
49
|
|
|
|
|
|
|
}
|
50
|
|
|
|
|
|
|
}
|
51
|
|
|
|
|
|
|
}
|
52
|
0
|
|
|
|
|
|
$self->language('i-default');
|
53
|
0
|
0
|
|
|
|
|
$self->logger
|
54
|
|
|
|
|
|
|
and $self->logger->(
|
55
|
|
|
|
|
|
|
'Fallback language "i-default" selected.',
|
56
|
|
|
|
|
|
|
{
|
57
|
|
|
|
|
|
|
object => $self,
|
58
|
|
|
|
|
|
|
type => 'warn',
|
59
|
|
|
|
|
|
|
event => 'language,selection,fallback',
|
60
|
|
|
|
|
|
|
},
|
61
|
|
|
|
|
|
|
);
|
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return;
|
64
|
|
|
|
|
|
|
}
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1;
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__
|