line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::DetectLanguage::Language; |
2
|
|
|
|
|
|
|
$WebService::DetectLanguage::Language::VERSION = '0.04'; |
3
|
2
|
|
|
2
|
|
76344
|
use 5.006; |
|
2
|
|
|
|
|
18
|
|
4
|
2
|
|
|
2
|
|
431
|
use Moo; |
|
2
|
|
|
|
|
9092
|
|
|
2
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has code => ( is => 'ro' ); |
7
|
|
|
|
|
|
|
has name => ( is => 'lazy' ); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my %code2name = ( |
10
|
|
|
|
|
|
|
aa => "AFAR", |
11
|
|
|
|
|
|
|
ab => "ABKHAZIAN", |
12
|
|
|
|
|
|
|
af => "AFRIKAANS", |
13
|
|
|
|
|
|
|
ak => "AKAN", |
14
|
|
|
|
|
|
|
am => "AMHARIC", |
15
|
|
|
|
|
|
|
ar => "ARABIC", |
16
|
|
|
|
|
|
|
as => "ASSAMESE", |
17
|
|
|
|
|
|
|
ay => "AYMARA", |
18
|
|
|
|
|
|
|
az => "AZERBAIJANI", |
19
|
|
|
|
|
|
|
ba => "BASHKIR", |
20
|
|
|
|
|
|
|
be => "BELARUSIAN", |
21
|
|
|
|
|
|
|
bg => "BULGARIAN", |
22
|
|
|
|
|
|
|
bh => "BIHARI", |
23
|
|
|
|
|
|
|
bi => "BISLAMA", |
24
|
|
|
|
|
|
|
bn => "BENGALI", |
25
|
|
|
|
|
|
|
bo => "TIBETAN", |
26
|
|
|
|
|
|
|
br => "BRETON", |
27
|
|
|
|
|
|
|
bs => "BOSNIAN", |
28
|
|
|
|
|
|
|
bug => "BUGINESE", |
29
|
|
|
|
|
|
|
ca => "CATALAN", |
30
|
|
|
|
|
|
|
ceb => "CEBUANO", |
31
|
|
|
|
|
|
|
chr => "CHEROKEE", |
32
|
|
|
|
|
|
|
co => "CORSICAN", |
33
|
|
|
|
|
|
|
crs => "SESELWA", |
34
|
|
|
|
|
|
|
cs => "CZECH", |
35
|
|
|
|
|
|
|
cy => "WELSH", |
36
|
|
|
|
|
|
|
da => "DANISH", |
37
|
|
|
|
|
|
|
de => "GERMAN", |
38
|
|
|
|
|
|
|
dv => "DHIVEHI", |
39
|
|
|
|
|
|
|
dz => "DZONGKHA", |
40
|
|
|
|
|
|
|
egy => "EGYPTIAN", |
41
|
|
|
|
|
|
|
el => "GREEK", |
42
|
|
|
|
|
|
|
en => "ENGLISH", |
43
|
|
|
|
|
|
|
eo => "ESPERANTO", |
44
|
|
|
|
|
|
|
es => "SPANISH", |
45
|
|
|
|
|
|
|
et => "ESTONIAN", |
46
|
|
|
|
|
|
|
eu => "BASQUE", |
47
|
|
|
|
|
|
|
fa => "PERSIAN", |
48
|
|
|
|
|
|
|
fi => "FINNISH", |
49
|
|
|
|
|
|
|
fj => "FIJIAN", |
50
|
|
|
|
|
|
|
fo => "FAROESE", |
51
|
|
|
|
|
|
|
fr => "FRENCH", |
52
|
|
|
|
|
|
|
fy => "FRISIAN", |
53
|
|
|
|
|
|
|
ga => "IRISH", |
54
|
|
|
|
|
|
|
gd => "SCOTS_GAELIC", |
55
|
|
|
|
|
|
|
gl => "GALICIAN", |
56
|
|
|
|
|
|
|
gn => "GUARANI", |
57
|
|
|
|
|
|
|
got => "GOTHIC", |
58
|
|
|
|
|
|
|
gu => "GUJARATI", |
59
|
|
|
|
|
|
|
gv => "MANX", |
60
|
|
|
|
|
|
|
ha => "HAUSA", |
61
|
|
|
|
|
|
|
haw => "HAWAIIAN", |
62
|
|
|
|
|
|
|
hi => "HINDI", |
63
|
|
|
|
|
|
|
hmn => "HMONG", |
64
|
|
|
|
|
|
|
hr => "CROATIAN", |
65
|
|
|
|
|
|
|
ht => "HAITIAN_CREOLE", |
66
|
|
|
|
|
|
|
hu => "HUNGARIAN", |
67
|
|
|
|
|
|
|
hy => "ARMENIAN", |
68
|
|
|
|
|
|
|
ia => "INTERLINGUA", |
69
|
|
|
|
|
|
|
id => "INDONESIAN", |
70
|
|
|
|
|
|
|
ie => "INTERLINGUE", |
71
|
|
|
|
|
|
|
ig => "IGBO", |
72
|
|
|
|
|
|
|
ik => "INUPIAK", |
73
|
|
|
|
|
|
|
is => "ICELANDIC", |
74
|
|
|
|
|
|
|
it => "ITALIAN", |
75
|
|
|
|
|
|
|
iu => "INUKTITUT", |
76
|
|
|
|
|
|
|
iw => "HEBREW", |
77
|
|
|
|
|
|
|
ja => "JAPANESE", |
78
|
|
|
|
|
|
|
jw => "JAVANESE", |
79
|
|
|
|
|
|
|
ka => "GEORGIAN", |
80
|
|
|
|
|
|
|
kha => "KHASI", |
81
|
|
|
|
|
|
|
kk => "KAZAKH", |
82
|
|
|
|
|
|
|
kl => "GREENLANDIC", |
83
|
|
|
|
|
|
|
km => "KHMER", |
84
|
|
|
|
|
|
|
kn => "KANNADA", |
85
|
|
|
|
|
|
|
ko => "KOREAN", |
86
|
|
|
|
|
|
|
ks => "KASHMIRI", |
87
|
|
|
|
|
|
|
ku => "KURDISH", |
88
|
|
|
|
|
|
|
ky => "KYRGYZ", |
89
|
|
|
|
|
|
|
la => "LATIN", |
90
|
|
|
|
|
|
|
lb => "LUXEMBOURGISH", |
91
|
|
|
|
|
|
|
lg => "GANDA", |
92
|
|
|
|
|
|
|
lif => "LIMBU", |
93
|
|
|
|
|
|
|
ln => "LINGALA", |
94
|
|
|
|
|
|
|
lo => "LAOTHIAN", |
95
|
|
|
|
|
|
|
lt => "LITHUANIAN", |
96
|
|
|
|
|
|
|
lv => "LATVIAN", |
97
|
|
|
|
|
|
|
mfe => "MAURITIAN_CREOLE", |
98
|
|
|
|
|
|
|
mg => "MALAGASY", |
99
|
|
|
|
|
|
|
mi => "MAORI", |
100
|
|
|
|
|
|
|
mk => "MACEDONIAN", |
101
|
|
|
|
|
|
|
ml => "MALAYALAM", |
102
|
|
|
|
|
|
|
mn => "MONGOLIAN", |
103
|
|
|
|
|
|
|
mr => "MARATHI", |
104
|
|
|
|
|
|
|
ms => "MALAY", |
105
|
|
|
|
|
|
|
mt => "MALTESE", |
106
|
|
|
|
|
|
|
my => "BURMESE", |
107
|
|
|
|
|
|
|
na => "NAURU", |
108
|
|
|
|
|
|
|
ne => "NEPALI", |
109
|
|
|
|
|
|
|
nl => "DUTCH", |
110
|
|
|
|
|
|
|
no => "NORWEGIAN", |
111
|
|
|
|
|
|
|
nr => "NDEBELE", |
112
|
|
|
|
|
|
|
nso => "PEDI", |
113
|
|
|
|
|
|
|
ny => "NYANJA", |
114
|
|
|
|
|
|
|
oc => "OCCITAN", |
115
|
|
|
|
|
|
|
om => "OROMO", |
116
|
|
|
|
|
|
|
or => "ORIYA", |
117
|
|
|
|
|
|
|
pa => "PUNJABI", |
118
|
|
|
|
|
|
|
pl => "POLISH", |
119
|
|
|
|
|
|
|
ps => "PASHTO", |
120
|
|
|
|
|
|
|
pt => "PORTUGUESE", |
121
|
|
|
|
|
|
|
qu => "QUECHUA", |
122
|
|
|
|
|
|
|
rm => "RHAETO_ROMANCE", |
123
|
|
|
|
|
|
|
rn => "RUNDI", |
124
|
|
|
|
|
|
|
ro => "ROMANIAN", |
125
|
|
|
|
|
|
|
ru => "RUSSIAN", |
126
|
|
|
|
|
|
|
rw => "KINYARWANDA", |
127
|
|
|
|
|
|
|
sa => "SANSKRIT", |
128
|
|
|
|
|
|
|
sco => "SCOTS", |
129
|
|
|
|
|
|
|
sd => "SINDHI", |
130
|
|
|
|
|
|
|
sg => "SANGO", |
131
|
|
|
|
|
|
|
si => "SINHALESE", |
132
|
|
|
|
|
|
|
sk => "SLOVAK", |
133
|
|
|
|
|
|
|
sl => "SLOVENIAN", |
134
|
|
|
|
|
|
|
sm => "SAMOAN", |
135
|
|
|
|
|
|
|
sn => "SHONA", |
136
|
|
|
|
|
|
|
so => "SOMALI", |
137
|
|
|
|
|
|
|
sq => "ALBANIAN", |
138
|
|
|
|
|
|
|
sr => "SERBIAN", |
139
|
|
|
|
|
|
|
ss => "SISWANT", |
140
|
|
|
|
|
|
|
st => "SESOTHO", |
141
|
|
|
|
|
|
|
su => "SUNDANESE", |
142
|
|
|
|
|
|
|
sv => "SWEDISH", |
143
|
|
|
|
|
|
|
sw => "SWAHILI", |
144
|
|
|
|
|
|
|
syr => "SYRIAC", |
145
|
|
|
|
|
|
|
ta => "TAMIL", |
146
|
|
|
|
|
|
|
te => "TELUGU", |
147
|
|
|
|
|
|
|
tg => "TAJIK", |
148
|
|
|
|
|
|
|
th => "THAI", |
149
|
|
|
|
|
|
|
ti => "TIGRINYA", |
150
|
|
|
|
|
|
|
tk => "TURKMEN", |
151
|
|
|
|
|
|
|
tl => "TAGALOG", |
152
|
|
|
|
|
|
|
tlh => "KLINGON", |
153
|
|
|
|
|
|
|
tn => "TSWANA", |
154
|
|
|
|
|
|
|
to => "TONGA", |
155
|
|
|
|
|
|
|
tr => "TURKISH", |
156
|
|
|
|
|
|
|
ts => "TSONGA", |
157
|
|
|
|
|
|
|
tt => "TATAR", |
158
|
|
|
|
|
|
|
ug => "UIGHUR", |
159
|
|
|
|
|
|
|
uk => "UKRAINIAN", |
160
|
|
|
|
|
|
|
ur => "URDU", |
161
|
|
|
|
|
|
|
uz => "UZBEK", |
162
|
|
|
|
|
|
|
ve => "VENDA", |
163
|
|
|
|
|
|
|
vi => "VIETNAMESE", |
164
|
|
|
|
|
|
|
vo => "VOLAPUK", |
165
|
|
|
|
|
|
|
war => "WARAY_PHILIPPINES", |
166
|
|
|
|
|
|
|
wo => "WOLOF", |
167
|
|
|
|
|
|
|
xh => "XHOSA", |
168
|
|
|
|
|
|
|
yi => "YIDDISH", |
169
|
|
|
|
|
|
|
yo => "YORUBA", |
170
|
|
|
|
|
|
|
za => "ZHUANG", |
171
|
|
|
|
|
|
|
zh => "CHINESE_SIMPLIFIED", |
172
|
|
|
|
|
|
|
"zh-Hant" => "CHINESE_TRADITIONAL", |
173
|
|
|
|
|
|
|
zu => "ZULU", |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
); |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub _build_name |
178
|
|
|
|
|
|
|
{ |
179
|
4
|
|
|
4
|
|
1248
|
my $self = shift; |
180
|
|
|
|
|
|
|
|
181
|
4
|
|
100
|
|
|
30
|
return $code2name{ $self->code } // "UNKNOWN"; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
1; |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 NAME |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
WebService::DetectLanguage::Language - a data object holding language code and name |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 SYNOPSIS |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
my @languages = $api->languages(); |
193
|
|
|
|
|
|
|
foreach my $lang (@languages) { |
194
|
|
|
|
|
|
|
printf "code=%s name=%s\n", $lang->code, $lang->name; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 DESCRIPTION |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
This module is a class for language information returned |
200
|
|
|
|
|
|
|
by the C, C, or C methods |
201
|
|
|
|
|
|
|
of L. |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
See the documentation of that module for more details. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=head2 code |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
A short code identifying the language. |
211
|
|
|
|
|
|
|
Most of these are two letters (for example "tl" for Tagalog), |
212
|
|
|
|
|
|
|
but some are three letters (for example "chr" for Cherokee), |
213
|
|
|
|
|
|
|
and at the time of writing there is one other: "zh-Hant" is the code for Traditional Chinese. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head2 name |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
The name of the language. |
218
|
|
|
|
|
|
|
Names are all in upper case, and have underscores rather than spaces. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 SEE ALSO |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
L the main module for talking |
224
|
|
|
|
|
|
|
to the language detection API at detectlanguage.com. |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
L is a list of all the |
227
|
|
|
|
|
|
|
languages supported by the API, giving both code and name. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
=head1 AUTHOR |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
Neil Bowers Eneilb@cpan.orgE |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
This software is copyright (c) 2019 by Neil Bowers . |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
238
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
239
|
|
|
|
|
|
|
|