line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rose::HTML::Object::Localized; |
2
|
|
|
|
|
|
|
|
3
|
43
|
|
|
43
|
|
420
|
use strict; |
|
43
|
|
|
|
|
94
|
|
|
43
|
|
|
|
|
1260
|
|
4
|
|
|
|
|
|
|
|
5
|
43
|
|
|
43
|
|
219
|
use Carp; |
|
43
|
|
|
|
|
102
|
|
|
43
|
|
|
|
|
2583
|
|
6
|
43
|
|
|
43
|
|
27806
|
use Rose::HTML::Object::Message::Localizer; |
|
43
|
|
|
|
|
128
|
|
|
43
|
|
|
|
|
1491
|
|
7
|
|
|
|
|
|
|
|
8
|
43
|
|
|
43
|
|
303
|
use base 'Rose::Object'; |
|
43
|
|
|
|
|
96
|
|
|
43
|
|
|
|
|
5531
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.600'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#our $Debug = 0; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use Rose::HTML::Object::MakeMethods::Localization |
15
|
|
|
|
|
|
|
( |
16
|
43
|
|
|
|
|
457
|
localized_errors => |
17
|
|
|
|
|
|
|
[ |
18
|
|
|
|
|
|
|
'errors', |
19
|
|
|
|
|
|
|
], |
20
|
43
|
|
|
43
|
|
21669
|
); |
|
43
|
|
|
|
|
132
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Rose::Class::MakeMethods::Generic |
23
|
|
|
|
|
|
|
( |
24
|
43
|
|
|
|
|
207
|
inheritable_scalar => |
25
|
|
|
|
|
|
|
[ |
26
|
|
|
|
|
|
|
'default_localizer', |
27
|
|
|
|
|
|
|
'default_locale', |
28
|
|
|
|
|
|
|
], |
29
|
43
|
|
|
43
|
|
7577
|
); |
|
43
|
|
|
|
|
92
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub localizer |
32
|
|
|
|
|
|
|
{ |
33
|
230
|
|
|
230
|
0
|
5276
|
my($invocant) = shift; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Called as object method |
36
|
230
|
100
|
|
|
|
523
|
if(my $class = ref $invocant) |
37
|
|
|
|
|
|
|
{ |
38
|
209
|
50
|
|
|
|
442
|
if(@_) |
39
|
|
|
|
|
|
|
{ |
40
|
0
|
|
|
|
|
0
|
return $invocant->{'localizer'} = shift; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
209
|
|
33
|
|
|
855
|
return $invocant->{'localizer'} || $class->default_localizer; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else # Called as class method |
46
|
|
|
|
|
|
|
{ |
47
|
21
|
100
|
|
|
|
61
|
if(@_) |
48
|
|
|
|
|
|
|
{ |
49
|
2
|
|
|
|
|
13
|
return $invocant->default_localizer(@_); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
19
|
|
|
|
|
76
|
return $invocant->default_localizer |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub locale |
57
|
|
|
|
|
|
|
{ |
58
|
94
|
|
|
94
|
0
|
567
|
my($invocant) = shift; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Called as an object method |
61
|
94
|
100
|
|
|
|
211
|
if(my $class = ref $invocant) |
62
|
|
|
|
|
|
|
{ |
63
|
93
|
100
|
|
|
|
198
|
if(@_) |
64
|
|
|
|
|
|
|
{ |
65
|
15
|
|
|
|
|
58
|
return $invocant->{'locale'} = shift; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
78
|
100
|
|
|
|
248
|
return $invocant->{'locale'} if($invocant->{'locale'}); |
69
|
|
|
|
|
|
|
|
70
|
47
|
|
|
|
|
98
|
foreach my $parent_name (qw(parent_group parent_field parent_form parent)) |
71
|
|
|
|
|
|
|
{ |
72
|
184
|
100
|
100
|
|
|
1265
|
if($invocant->can($parent_name) && (my $parent = $invocant->$parent_name())) |
73
|
|
|
|
|
|
|
{ |
74
|
4
|
|
|
|
|
16
|
my $locale = $parent->locale; |
75
|
4
|
50
|
|
|
|
160
|
return $locale if(defined $locale); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
43
|
|
33
|
|
|
110
|
return $invocant->localizer->locale || $invocant->localizer->default_locale; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
else # Called as a class method |
82
|
|
|
|
|
|
|
{ |
83
|
1
|
50
|
|
|
|
4
|
if(@_) |
84
|
|
|
|
|
|
|
{ |
85
|
0
|
|
|
|
|
0
|
return $invocant->default_locale(shift); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
1
|
|
33
|
|
|
4
|
return $invocant->localizer->locale || $invocant->default_locale; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |