line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
18
|
|
|
18
|
|
103673
|
use v5.14; |
|
18
|
|
|
|
|
86
|
|
2
|
18
|
|
|
18
|
|
115
|
use warnings; |
|
18
|
|
|
|
|
59
|
|
|
18
|
|
|
|
|
1037
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Test::BDD::Cucumber::I18n 0.85; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=encoding utf8 |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Test::BDD::Cucumber::I18N - Internationalization |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
version 0.85 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Internationalization of feature files and step definitions. |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Test::BDD::Cucumber::I18n |
23
|
|
|
|
|
|
|
qw(languages has_language langdef); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# get codes of supported languages |
26
|
|
|
|
|
|
|
my @supported_languages = languages(); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# look up if a language is supported |
29
|
|
|
|
|
|
|
my $language_is_supported = has_language('de'); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# get definition of a language |
32
|
|
|
|
|
|
|
my $langdef = langdef('de'); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# get readable keyword definitions |
35
|
|
|
|
|
|
|
my $string = readable_keywords |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
18
|
|
|
18
|
|
8810
|
use utf8; |
|
18
|
|
|
|
|
272
|
|
|
18
|
|
|
|
|
147
|
|
40
|
|
|
|
|
|
|
|
41
|
18
|
|
|
18
|
|
653
|
use base 'Exporter'; |
|
18
|
|
|
|
|
50
|
|
|
18
|
|
|
|
|
3152
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
our @EXPORT_OK = |
44
|
|
|
|
|
|
|
qw(languages langdef has_language readable_keywords keyword_to_subname); |
45
|
|
|
|
|
|
|
|
46
|
18
|
|
|
18
|
|
9855
|
use Test::BDD::Cucumber::I18N::Data; |
|
18
|
|
|
|
|
175
|
|
|
18
|
|
|
|
|
5488
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 languages |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Get codes of supported languages. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=cut |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub languages { |
57
|
13
|
|
|
13
|
1
|
720
|
return sort keys %Test::BDD::Cucumber::I18N::Data::languages; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 has_language($language) |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Check if a language is supported. Takes as argument the language |
63
|
|
|
|
|
|
|
abbreviation defined in C. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub has_language { |
68
|
972
|
|
|
972
|
1
|
1464
|
my ($language) = @_; |
69
|
972
|
|
|
|
|
2480
|
return exists $Test::BDD::Cucumber::I18N::Data::languages{$language}; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 langdef($language) |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Get definition of a language. Takes as argument the language abbreviation |
75
|
|
|
|
|
|
|
defined in C. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub langdef { |
80
|
972
|
|
|
972
|
1
|
2108
|
my ($language) = @_; |
81
|
|
|
|
|
|
|
|
82
|
972
|
50
|
|
|
|
1635
|
return unless has_language($language); |
83
|
972
|
|
|
|
|
2310
|
return $Test::BDD::Cucumber::I18N::Data::languages{$language}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head2 readable_keywords($string, $transform) |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Get readable keyword definitions. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub readable_keywords { |
93
|
0
|
|
|
0
|
1
|
0
|
my ( $string, $transform ) = @_; |
94
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
0
|
my @keywords = split( /\|/, $string ); |
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
|
|
|
0
|
@keywords = map { $transform->($_) } @keywords if $transform; |
|
0
|
|
|
|
|
0
|
|
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
0
|
return join( ', ', map { '"' . $_ . '"' } @keywords ); |
|
0
|
|
|
|
|
0
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head2 keyword_to_subname |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Return a keyword into a subname with non-word characters removed. |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=cut |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub keyword_to_subname { |
109
|
4716
|
|
|
4716
|
1
|
7665
|
my ($word) = @_; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# remove non-word characters so we have a decent sub name |
112
|
17
|
|
|
17
|
|
133
|
$word =~ s{[^\p{Word}]}{}g; |
|
17
|
|
|
|
|
38
|
|
|
17
|
|
|
|
|
238
|
|
|
4716
|
|
|
|
|
16901
|
|
113
|
|
|
|
|
|
|
|
114
|
4716
|
|
|
|
|
10715
|
return $word; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 LANGUAGES |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Languages are defined in L, and have been |
120
|
|
|
|
|
|
|
lifted from the Gherkin distribution. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Gregor Goldbach C |
125
|
|
|
|
|
|
|
(based on the works of Pablo Duboue) |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 LICENSE |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright 2019-2023, Erik Huelsmann |
130
|
|
|
|
|
|
|
Copyright 2014-2019, Gregor Goldbach; Licensed under the same terms as Perl |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=cut |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
1; |