line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::LanguageName; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
21526
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
808
|
use parent qw(Template::Plugin::Filter); |
|
1
|
|
|
|
|
290
|
|
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
8123
|
use Locale::Codes::Language; |
|
1
|
|
|
|
|
271849
|
|
|
1
|
|
|
|
|
217
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Template::Plugin::LanguageName - Template filter to lookup the name for a ISO639-1 or ISO639-2 language code |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.0101 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.0101'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
[% USE LanguageName %] |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
[% "fr" | language_name %] |
25
|
|
|
|
|
|
|
=> "French" |
26
|
|
|
|
|
|
|
[% "gre" | language_name %] |
27
|
|
|
|
|
|
|
=> "Greek, Modern (1453-)" |
28
|
|
|
|
|
|
|
[% "xx" | language_name %] |
29
|
|
|
|
|
|
|
=> undef |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $FILTER_NAME = 'language_name'; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub init { |
36
|
0
|
|
|
0
|
0
|
|
my $self = $_[0]; |
37
|
0
|
|
|
|
|
|
$self->install_filter($FILTER_NAME); |
38
|
0
|
|
|
|
|
|
$self; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub filter { |
42
|
0
|
|
|
0
|
0
|
|
my $code = $_[1]; |
43
|
0
|
0
|
|
|
|
|
code2language($code, length($code) == 3 ? LOCALE_LANG_ALPHA_3 : LOCALE_LANG_ALPHA_2); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head1 SEE ALSO |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
L. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |