line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
2
|
|
|
2
|
|
2277
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
9
|
use namespace::autoclean; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
54
|
|
5
|
2
|
|
|
2
|
|
8
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
11
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.37'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use Carp qw( carp ); |
9
|
2
|
|
|
2
|
|
176
|
use DateTime::Locale; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
123
|
|
10
|
2
|
|
|
2
|
|
12
|
use List::Util 1.45 (); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
50
|
|
11
|
2
|
|
|
2
|
|
10
|
use Params::ValidationCompiler 0.13 qw( validation_for ); |
|
2
|
|
|
|
|
37
|
|
|
2
|
|
|
|
|
116
|
|
12
|
2
|
|
|
2
|
|
13
|
use Specio::Declare; |
|
2
|
|
|
|
|
33
|
|
|
2
|
|
|
|
|
75
|
|
13
|
2
|
|
|
2
|
|
10
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
21
|
|
14
|
|
|
|
|
|
|
BEGIN { |
15
|
|
|
|
|
|
|
foreach my $field ( |
16
|
2
|
|
|
2
|
|
8
|
qw( id en_complete_name native_complete_name |
17
|
|
|
|
|
|
|
en_language en_script en_territory en_variant |
18
|
|
|
|
|
|
|
native_language native_script native_territory native_variant |
19
|
|
|
|
|
|
|
) |
20
|
|
|
|
|
|
|
) { |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# remove leading 'en_' for method name |
23
|
|
|
|
|
|
|
( my $meth_name = $field ) =~ s/^en_//; |
24
|
22
|
|
|
|
|
49
|
|
25
|
|
|
|
|
|
|
# also remove 'complete_' |
26
|
|
|
|
|
|
|
$meth_name =~ s/complete_//; |
27
|
22
|
|
|
|
|
33
|
|
28
|
|
|
|
|
|
|
no strict 'refs'; |
29
|
2
|
|
|
2
|
|
525
|
*{$meth_name} = sub { $_[0]->{$field} }; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
134
|
|
30
|
22
|
|
|
6
|
|
63
|
} |
|
22
|
|
|
|
|
1837
|
|
|
6
|
|
|
|
|
5680
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $class = shift; |
34
|
|
|
|
|
|
|
|
35
|
7
|
|
|
7
|
0
|
13
|
# By making the default format lengths part of the object's hash |
36
|
|
|
|
|
|
|
# key, it allows them to be settable. |
37
|
|
|
|
|
|
|
return bless { |
38
|
|
|
|
|
|
|
@_, |
39
|
7
|
|
|
|
|
43
|
default_date_format_length => 'long', |
40
|
|
|
|
|
|
|
default_time_format_length => 'long', |
41
|
|
|
|
|
|
|
}, $class; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
my @FormatLengths = qw( short medium long full ); |
46
|
0
|
|
|
0
|
1
|
|
|
47
|
0
|
|
|
0
|
1
|
|
my $meth = 'date_format_' . $_[0]->default_date_format_length(); |
48
|
0
|
|
|
0
|
1
|
|
$_[0]->$meth(); |
49
|
0
|
|
|
0
|
1
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return { |
52
|
|
|
|
|
|
|
map { |
53
|
|
|
|
|
|
|
my $meth = 'date_format_' . $_; |
54
|
0
|
|
|
0
|
1
|
|
$_ => $_[0]->$meth() |
55
|
0
|
|
|
|
|
|
} @FormatLengths |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $meth = 'time_format_' . $_[0]->default_time_format_length(); |
60
|
|
|
|
|
|
|
$_[0]->$meth(); |
61
|
0
|
|
|
0
|
1
|
|
} |
|
0
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
return { |
64
|
|
|
|
|
|
|
map { |
65
|
|
|
|
|
|
|
my $meth = 'time_format_' . $_; |
66
|
|
|
|
|
|
|
$_ => $_[0]->$meth() |
67
|
|
|
|
|
|
|
} @FormatLengths |
68
|
0
|
|
|
0
|
1
|
|
}; |
69
|
0
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $self = shift; |
72
|
|
|
|
|
|
|
my $for = shift; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $meth = '_format_for_' . $for; |
75
|
0
|
|
|
0
|
1
|
|
|
|
0
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return unless $self->can($meth); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
return $self->$meth(); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
my $self = shift; |
82
|
0
|
|
|
0
|
1
|
|
|
83
|
0
|
|
|
|
|
|
# The various parens seem to be necessary to force uniq() to see |
84
|
|
|
|
|
|
|
# the caller's list context. Go figure. |
85
|
0
|
|
|
|
|
|
my @uniq |
86
|
|
|
|
|
|
|
= List::Util::uniq( map { keys %{ $_->_available_formats() || {} } } |
87
|
0
|
0
|
|
|
|
|
_self_and_super_path( ref $self ) ); |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
# Doing the sort in the same expression doesn't work under 5.6.x. |
90
|
|
|
|
|
|
|
return sort @uniq; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
0
|
|
|
0
|
1
|
|
# Copied wholesale from Class::ISA, because said module warns as deprecated |
94
|
|
|
|
|
|
|
# with perl 5.11.0+, which is kind of annoying. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
# Assumption: searching is depth-first. |
97
|
|
|
|
|
|
|
# Assumption: '' (empty string) can't be a class package name. |
98
|
0
|
0
|
|
|
|
|
# Note: 'UNIVERSAL' is not given any special treatment. |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
return () unless @_; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
my @out = (); |
102
|
0
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my @in_stack = ( $_[0] ); |
104
|
|
|
|
|
|
|
my %seen = ( $_[0] => 1 ); |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $current; |
107
|
|
|
|
|
|
|
while (@in_stack) { |
108
|
|
|
|
|
|
|
next unless defined( $current = shift @in_stack ) && length($current); |
109
|
|
|
|
|
|
|
push @out, $current; |
110
|
|
|
|
|
|
|
no strict 'refs'; |
111
|
|
|
|
|
|
|
unshift @in_stack, map { |
112
|
0
|
0
|
|
0
|
|
|
my $c = $_; # copy, to avoid being destructive |
113
|
|
|
|
|
|
|
substr( $c, 0, 2 ) = "main::" if substr( $c, 0, 2 ) eq '::'; |
114
|
0
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# Canonize the :: -> main::, ::foo -> main::foo thing. |
116
|
0
|
|
|
|
|
|
# Should I ever canonize the Foo'Bar = Foo::Bar thing? |
117
|
0
|
|
|
|
|
|
$seen{$c}++ ? () : $c; |
118
|
|
|
|
|
|
|
} @{"$current\::ISA"}; |
119
|
0
|
|
|
|
|
|
|
120
|
0
|
|
|
|
|
|
# I.e., if this class has any parents (at least, ones I've never seen |
121
|
0
|
0
|
0
|
|
|
|
# before), push them, in order, onto the stack of classes I need to |
122
|
0
|
|
|
|
|
|
# explore. |
123
|
2
|
|
|
2
|
|
13
|
} |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
726
|
|
124
|
|
|
|
|
|
|
|
125
|
0
|
|
|
|
|
|
return @out; |
126
|
0
|
0
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
# Just needed for the above method. |
129
|
|
|
|
|
|
|
|
130
|
0
|
0
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
my $length = enum( values => [qw( full long medium short )] ); |
|
0
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
my $validator = validation_for( |
133
|
|
|
|
|
|
|
name => '_check_length_parameter', |
134
|
|
|
|
|
|
|
name_is_optional => 1, |
135
|
|
|
|
|
|
|
params => [ { type => $length } ], |
136
|
|
|
|
|
|
|
); |
137
|
|
|
|
|
|
|
|
138
|
0
|
|
|
|
|
|
my $self = shift; |
139
|
|
|
|
|
|
|
my ($l) = $validator->(@_); |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
$self->{default_date_format_length} = lc $l; |
142
|
|
|
|
0
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
0
|
|
|
0
|
1
|
|
|
145
|
|
|
|
|
|
|
my $self = shift; |
146
|
|
|
|
|
|
|
my ($l) = $validator->(@_); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
$self->{default_time_format_length} = lc $l; |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
for my $length (qw( full long medium short )) { |
152
|
|
|
|
|
|
|
my $key = 'datetime_format_' . $length; |
153
|
|
|
|
|
|
|
|
154
|
0
|
|
|
0
|
1
|
|
my $sub = sub { |
155
|
0
|
|
|
|
|
|
my $self = shift; |
156
|
|
|
|
|
|
|
|
157
|
0
|
|
|
|
|
|
return $self->{$key} if exists $self->{$key}; |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
my $date_meth = 'date_format_' . $length; |
160
|
0
|
|
|
0
|
1
|
|
my $time_meth = 'time_format_' . $length; |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
return $self->{$key} |
163
|
0
|
|
|
0
|
1
|
|
= $self->_make_datetime_format( $date_meth, $time_meth ); |
164
|
0
|
|
|
|
|
|
}; |
165
|
|
|
|
|
|
|
|
166
|
0
|
|
|
|
|
|
no strict 'refs'; |
167
|
|
|
|
|
|
|
*{$key} = $sub; |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
my $self = shift; |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
my $date_meth = 'date_format_' . $self->default_date_format_length(); |
173
|
0
|
|
|
0
|
|
|
my $time_meth = 'time_format_' . $self->default_time_format_length(); |
174
|
|
|
|
|
|
|
|
175
|
0
|
0
|
|
|
|
|
return $self->_make_datetime_format( $date_meth, $time_meth ); |
176
|
|
|
|
|
|
|
} |
177
|
0
|
|
|
|
|
|
|
178
|
0
|
|
|
|
|
|
my $self = shift; |
179
|
|
|
|
|
|
|
my $date_meth = shift; |
180
|
0
|
|
|
|
|
|
my $time_meth = shift; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
my $dt_format = $self->datetime_format(); |
183
|
|
|
|
|
|
|
|
184
|
2
|
|
|
2
|
|
14
|
my $time = $self->$time_meth(); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
2829
|
|
185
|
|
|
|
|
|
|
my $date = $self->$date_meth(); |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
$dt_format =~ s/\{0\}/$time/g; |
188
|
|
|
|
|
|
|
$dt_format =~ s/\{1\}/$date/g; |
189
|
0
|
|
|
0
|
1
|
|
|
190
|
|
|
|
|
|
|
return $dt_format; |
191
|
0
|
|
|
|
|
|
} |
192
|
0
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
my $self = shift; |
194
|
0
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
return $self->{prefers_24_hour_time} |
196
|
|
|
|
|
|
|
if exists $self->{prefers_24_hour_time}; |
197
|
|
|
|
|
|
|
|
198
|
0
|
|
|
0
|
|
|
$self->{prefers_24_hour_time} |
199
|
0
|
|
|
|
|
|
= $self->time_format_short() =~ /h|K/ ? 0 : 1; |
200
|
0
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
0
|
|
|
|
|
|
# Backwards compat for DateTime.pm version <= 0.42 |
203
|
|
|
|
|
|
|
{ |
204
|
0
|
|
|
|
|
|
my %subs = ( |
205
|
0
|
|
|
|
|
|
month_name => sub { $_[0]->month_format_wide()->[ $_[1]->month_0 ] }, |
206
|
|
|
|
|
|
|
|
207
|
0
|
|
|
|
|
|
month_abbreviation => sub { |
208
|
0
|
|
|
|
|
|
$_[0]->month_format_abbreviated()->[ $_[1]->month_0 ]; |
209
|
|
|
|
|
|
|
}, |
210
|
0
|
|
|
|
|
|
month_narrow => |
211
|
|
|
|
|
|
|
sub { $_[0]->month_format_narrow()->[ $_[1]->month_0 ]; }, |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
month_names => sub { $_[0]->month_format_wide() }, |
214
|
0
|
|
|
0
|
1
|
|
month_abbreviations => sub { $_[0]->month_format_abbreviated() }, |
215
|
|
|
|
|
|
|
month_narrows => sub { $_[0]->month_format_narrow() }, |
216
|
|
|
|
|
|
|
|
217
|
0
|
0
|
|
|
|
|
day_name => |
218
|
|
|
|
|
|
|
sub { $_[0]->day_format_wide()->[ $_[1]->day_of_week_0 ] }, |
219
|
|
|
|
|
|
|
|
220
|
0
|
0
|
|
|
|
|
day_abbreviation => sub { |
221
|
|
|
|
|
|
|
$_[0]->day_format_abbreviated()->[ $_[1]->day_of_week_0 ]; |
222
|
|
|
|
|
|
|
}, |
223
|
|
|
|
|
|
|
day_narrow => |
224
|
|
|
|
|
|
|
sub { $_[0]->day_format_narrow()->[ $_[1]->day_of_week_0 ]; }, |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
day_names => sub { $_[0]->day_format_wide() }, |
227
|
|
|
|
|
|
|
day_abbreviations => sub { $_[0]->day_format_abbreviated() }, |
228
|
|
|
|
|
|
|
day_narrows => sub { $_[0]->day_format_narrow() }, |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
quarter_name => |
231
|
|
|
|
|
|
|
sub { $_[0]->quarter_format_wide()->[ $_[1]->quarter - 1 ] }, |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
quarter_abbreviation => sub { |
234
|
|
|
|
|
|
|
$_[0]->quarter_format_abbreviated()->[ $_[1]->quarter - 1 ]; |
235
|
|
|
|
|
|
|
}, |
236
|
|
|
|
|
|
|
quarter_narrow => |
237
|
|
|
|
|
|
|
sub { $_[0]->quarter_format_narrow()->[ $_[1]->quarter - 1 ] }, |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
quarter_names => sub { $_[0]->quarter_format_wide() }, |
240
|
|
|
|
|
|
|
quarter_abbreviations => sub { $_[0]->quarter_format_abbreviated() }, |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
am_pm => |
243
|
|
|
|
|
|
|
sub { $_[0]->am_pm_abbreviated()->[ $_[1]->hour < 12 ? 0 : 1 ] }, |
244
|
|
|
|
|
|
|
am_pms => sub { $_[0]->am_pm_abbreviated() }, |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
era_name => sub { $_[0]->era_wide()->[ $_[1]->ce_year < 0 ? 0 : 1 ] }, |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
era_abbreviation => sub { |
249
|
|
|
|
|
|
|
$_[0]->era_abbreviated()->[ $_[1]->ce_year < 0 ? 0 : 1 ]; |
250
|
|
|
|
|
|
|
}, |
251
|
|
|
|
|
|
|
era_narrow => |
252
|
|
|
|
|
|
|
sub { $_[0]->era_narrow()->[ $_[1]->ce_year < 0 ? 0 : 1 ] }, |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
era_names => sub { $_[0]->era_wide() }, |
255
|
|
|
|
|
|
|
era_abbreviations => sub { $_[0]->era_abbreviated() }, |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
# ancient backwards compat |
258
|
|
|
|
|
|
|
era => sub { $_[0]->era_abbreviation }, |
259
|
|
|
|
|
|
|
eras => sub { $_[0]->era_abbreviations }, |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
date_before_time => sub { |
262
|
|
|
|
|
|
|
my $self = shift; |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
my $dt_format = $self->datetime_format(); |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
return $dt_format =~ /\{1\}.*\{0\}/ ? 1 : 0; |
267
|
|
|
|
|
|
|
}, |
268
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
date_parts_order => sub { |
270
|
|
|
|
|
|
|
my $self = shift; |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
my $short = $self->date_format_short(); |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
$short =~ tr{dmyDMY}{}cd; |
275
|
|
|
|
|
|
|
$short =~ tr{dmyDMY}{dmydmy}s; |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
return $short; |
278
|
|
|
|
|
|
|
}, |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
full_date_format => sub { |
281
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->date_format_full() ); |
282
|
|
|
|
|
|
|
}, |
283
|
|
|
|
|
|
|
|
284
|
|
|
|
|
|
|
long_date_format => sub { |
285
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->date_format_long() ); |
286
|
|
|
|
|
|
|
}, |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
medium_date_format => sub { |
289
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->date_format_medium() ); |
290
|
|
|
|
|
|
|
}, |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
short_date_format => sub { |
293
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->date_format_short() ); |
294
|
|
|
|
|
|
|
}, |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
default_date_format => sub { |
297
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->date_format_default() ); |
298
|
|
|
|
|
|
|
}, |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
full_time_format => sub { |
301
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->time_format_full() ); |
302
|
|
|
|
|
|
|
}, |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
long_time_format => sub { |
305
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->time_format_long() ); |
306
|
|
|
|
|
|
|
}, |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
medium_time_format => sub { |
309
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->time_format_medium() ); |
310
|
|
|
|
|
|
|
}, |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
short_time_format => sub { |
313
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->time_format_short() ); |
314
|
|
|
|
|
|
|
}, |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
default_time_format => sub { |
317
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->time_format_default() ); |
318
|
|
|
|
|
|
|
}, |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
full_datetime_format => sub { |
321
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->datetime_format_full() ); |
322
|
|
|
|
|
|
|
}, |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
long_datetime_format => sub { |
325
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->datetime_format_long() ); |
326
|
|
|
|
|
|
|
}, |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
medium_datetime_format => sub { |
329
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->datetime_format_medium() ); |
330
|
|
|
|
|
|
|
}, |
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
short_datetime_format => sub { |
333
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->datetime_format_short() ); |
334
|
|
|
|
|
|
|
}, |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
default_datetime_format => sub { |
337
|
|
|
|
|
|
|
$_[0]->_convert_to_strftime( $_[0]->datetime_format_default() ); |
338
|
|
|
|
|
|
|
}, |
339
|
|
|
|
|
|
|
); |
340
|
|
|
|
|
|
|
|
341
|
|
|
|
|
|
|
for my $name ( keys %subs ) { |
342
|
|
|
|
|
|
|
my $real_sub = $subs{$name}; |
343
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
my $sub = sub { |
345
|
|
|
|
|
|
|
carp |
346
|
|
|
|
|
|
|
"The $name method in DateTime::Locale::Base has been deprecated. Please see the DateTime::Locale distribution's Changes file for details"; |
347
|
|
|
|
|
|
|
return shift->$real_sub(@_); |
348
|
|
|
|
|
|
|
}; |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
no strict 'refs'; |
351
|
|
|
|
|
|
|
*{$name} = $sub; |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
} |
354
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
# Older versions of DateTime.pm will not pass in the $cldr_ok flag, so |
356
|
|
|
|
|
|
|
# we will give them the converted-to-strftime pattern (bugs and all). |
357
|
|
|
|
|
|
|
my $self = shift; |
358
|
|
|
|
|
|
|
my $pattern = shift; |
359
|
|
|
|
|
|
|
my $cldr_ok = shift; |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
return $pattern if $cldr_ok; |
362
|
|
|
|
|
|
|
|
363
|
|
|
|
|
|
|
return $self->{_converted_patterns}{$pattern} |
364
|
|
|
|
|
|
|
if exists $self->{_converted_patterns}{$pattern}; |
365
|
|
|
|
|
|
|
|
366
|
0
|
|
|
0
|
|
|
return $self->{_converted_patterns}{$pattern} |
367
|
|
|
|
|
|
|
= $self->_cldr_to_strftime($pattern); |
368
|
0
|
|
|
|
|
|
} |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
{ |
371
|
2
|
|
|
2
|
|
15
|
my @JavaPatterns = ( |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1791
|
|
372
|
|
|
|
|
|
|
qr/G/ => '{era}', |
373
|
|
|
|
|
|
|
qr/yyyy/ => '{ce_year}', |
374
|
|
|
|
|
|
|
qr/y/ => 'y', |
375
|
|
|
|
|
|
|
qr/u/ => 'Y', |
376
|
|
|
|
|
|
|
qr/MMMM/ => 'B', |
377
|
|
|
|
|
|
|
qr/MMM/ => 'b', |
378
|
|
|
|
|
|
|
qr/MM/ => 'm', |
379
|
0
|
|
|
0
|
|
|
qr/M/ => '{month}', |
380
|
0
|
|
|
|
|
|
qr/dd/ => 'd', |
381
|
0
|
|
|
|
|
|
qr/d/ => '{day}', |
382
|
|
|
|
|
|
|
qr/hh/ => 'l', |
383
|
0
|
0
|
|
|
|
|
qr/h/ => '{hour_12}', |
384
|
|
|
|
|
|
|
qr/HH/ => 'H', |
385
|
|
|
|
|
|
|
qr/H/ => '{hour}', |
386
|
0
|
0
|
|
|
|
|
qr/mm/ => 'M', |
387
|
|
|
|
|
|
|
qr/m/ => '{minute}', |
388
|
0
|
|
|
|
|
|
qr/ss/ => 'S', |
389
|
|
|
|
|
|
|
qr/s/ => '{second}', |
390
|
|
|
|
|
|
|
qr/S/ => 'N', |
391
|
|
|
|
|
|
|
qr/EEEE/ => 'A', |
392
|
|
|
|
|
|
|
qr/E/ => 'a', |
393
|
|
|
|
|
|
|
qr/D/ => 'j', |
394
|
|
|
|
|
|
|
qr/F/ => '{weekday_of_month}', |
395
|
|
|
|
|
|
|
qr/w/ => 'V', |
396
|
|
|
|
|
|
|
qr/W/ => '{week_month}', |
397
|
|
|
|
|
|
|
qr/a/ => 'p', |
398
|
|
|
|
|
|
|
qr/k/ => '{hour_1}', |
399
|
|
|
|
|
|
|
qr/K/ => '{hour_12_0}', |
400
|
|
|
|
|
|
|
qr/z/ => '{time_zone_long_name}', |
401
|
|
|
|
|
|
|
); |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
shift; |
404
|
|
|
|
|
|
|
my $simple = shift; |
405
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
$simple |
407
|
|
|
|
|
|
|
=~ s/(G+|y+|u+|M+|d+|h+|H+|m+|s+|S+|E+|D+|F+|w+|W+|a+|k+|K+|z+)|'((?:[^']|'')*)'/ |
408
|
|
|
|
|
|
|
$2 ? _stringify($2) : $1 ? _convert($1) : "'"/eg; |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
return $simple; |
411
|
|
|
|
|
|
|
} |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
my $simple = shift; |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
for ( my $x = 0; $x < @JavaPatterns; $x += 2 ) { |
416
|
|
|
|
|
|
|
return '%' . $JavaPatterns[ $x + 1 ] |
417
|
|
|
|
|
|
|
if $simple =~ /$JavaPatterns[$x]/; |
418
|
|
|
|
|
|
|
} |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
die "**Dont know $simple***"; |
421
|
|
|
|
|
|
|
} |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
my $string = shift; |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
$string =~ s/%(?:[^%])/%%/g; |
426
|
0
|
|
|
0
|
|
|
$string =~ s/\'\'/\'/g; |
427
|
0
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
return $string; |
429
|
0
|
|
|
|
|
|
} |
430
|
|
|
|
|
|
|
} |
431
|
0
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
432
|
|
|
|
|
|
|
# end backwards compat |
433
|
0
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
my $self = shift; |
435
|
|
|
|
|
|
|
my $cloning = shift; |
436
|
|
|
|
|
|
|
|
437
|
0
|
|
|
0
|
|
|
return if $cloning; |
438
|
|
|
|
|
|
|
|
439
|
0
|
|
|
|
|
|
return $self->id(); |
440
|
0
|
0
|
|
|
|
|
} |
441
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
my $self = shift; |
443
|
|
|
|
|
|
|
shift; |
444
|
0
|
|
|
|
|
|
my $serialized = shift; |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
my $obj = DateTime::Locale->load($serialized); |
447
|
|
|
|
|
|
|
|
448
|
0
|
|
|
0
|
|
|
%$self = %$obj; |
449
|
|
|
|
|
|
|
|
450
|
0
|
|
|
|
|
|
return $self; |
451
|
0
|
|
|
|
|
|
} |
452
|
|
|
|
|
|
|
|
453
|
0
|
|
|
|
|
|
1; |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
# ABSTRACT: Base class for individual locale objects (deprecated) |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
=pod |
459
|
|
|
|
|
|
|
|
460
|
0
|
|
|
0
|
0
|
|
=encoding UTF-8 |
461
|
0
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=head1 NAME |
463
|
0
|
0
|
|
|
|
|
|
464
|
|
|
|
|
|
|
DateTime::Locale::Base - Base class for individual locale objects (deprecated) |
465
|
0
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=head1 VERSION |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
version 1.37 |
469
|
0
|
|
|
0
|
0
|
|
|
470
|
0
|
|
|
|
|
|
=head1 SYNOPSIS |
471
|
0
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
use base 'DateTime::Locale::Base'; |
473
|
0
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=head1 DESCRIPTION |
475
|
0
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
B<This module is no longer used by the code in the distribution.> It is still |
477
|
0
|
|
|
|
|
|
included for the sake of any code out in the wild that may subclass this class. |
478
|
|
|
|
|
|
|
This class will be removed in a future release. |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=head1 DEFAULT FORMATS |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
Each locale has a set of four default date and time formats. They are |
483
|
|
|
|
|
|
|
distinguished by length, and are called "full", "long", "medium", and "short". |
484
|
|
|
|
|
|
|
Each locale may have a different default length which it uses when its C<< |
485
|
|
|
|
|
|
|
$locale->date_format_default() >>, C<< $locale->time_format_default() >>, or |
486
|
|
|
|
|
|
|
C<< $locale->datetime_format_default() >> methods are called. |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
This can be changed by calling the C<< $locale->set_default_date_format() >> or |
489
|
|
|
|
|
|
|
C<< $locale->set_default_time_format() >> methods. These methods accept a |
490
|
|
|
|
|
|
|
string which must be one of "full", "long", "medium", or "short". |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
=head1 NAME FORMS |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
Most names come in a number of variations. First, they may vary based on |
495
|
|
|
|
|
|
|
length, with wide, abbreviated, and narrow forms. The wide form is typically |
496
|
|
|
|
|
|
|
the full name, while the narrow form is often a single character. The narrow |
497
|
|
|
|
|
|
|
forms may not be unique. For example, "T" may be used for Tuesday and Thursday |
498
|
|
|
|
|
|
|
in the English narrow forms. |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
Many names also distinguish between "format" and "stand-alone" forms of a |
501
|
|
|
|
|
|
|
pattern. The format pattern is used when the thing in question is being placed |
502
|
|
|
|
|
|
|
into a larger string. The stand-alone form is used when displaying that item by |
503
|
|
|
|
|
|
|
itself, for example in a calendar. |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
=head1 METHODS |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
All locales provide the following methods: |
508
|
|
|
|
|
|
|
|
509
|
|
|
|
|
|
|
=over 4 |
510
|
|
|
|
|
|
|
|
511
|
|
|
|
|
|
|
=item * $locale->id() |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
The locale's id. |
514
|
|
|
|
|
|
|
|
515
|
|
|
|
|
|
|
=item * $locale->language_id() |
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
The language portion of the id. |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
=item * $locale->script_id() |
520
|
|
|
|
|
|
|
|
521
|
|
|
|
|
|
|
The script portion of the id, if any. |
522
|
|
|
|
|
|
|
|
523
|
|
|
|
|
|
|
=item * $locale->territory_id() |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
The territory portion of the id, if any. |
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
=item * $locale->variant_id() |
528
|
|
|
|
|
|
|
|
529
|
|
|
|
|
|
|
The variant portion of the id, if any. |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
=item * $locale->name() |
532
|
|
|
|
|
|
|
|
533
|
|
|
|
|
|
|
The full name for the locale in English. |
534
|
|
|
|
|
|
|
|
535
|
|
|
|
|
|
|
=item * $locale->language() |
536
|
|
|
|
|
|
|
|
537
|
|
|
|
|
|
|
The language name for the locale in English. |
538
|
|
|
|
|
|
|
|
539
|
|
|
|
|
|
|
=item * $locale->script() |
540
|
|
|
|
|
|
|
|
541
|
|
|
|
|
|
|
The script name for the locale in English, if any. |
542
|
|
|
|
|
|
|
|
543
|
|
|
|
|
|
|
=item * $locale->territory() |
544
|
|
|
|
|
|
|
|
545
|
|
|
|
|
|
|
The territory name for the locale in English, if any. |
546
|
|
|
|
|
|
|
|
547
|
|
|
|
|
|
|
=item * $locale->variant() |
548
|
|
|
|
|
|
|
|
549
|
|
|
|
|
|
|
The variant name for the locale in English, if any. |
550
|
|
|
|
|
|
|
|
551
|
|
|
|
|
|
|
=item * $locale->native_name() |
552
|
|
|
|
|
|
|
|
553
|
|
|
|
|
|
|
The full name for the locale in its native language, if any. |
554
|
|
|
|
|
|
|
|
555
|
|
|
|
|
|
|
=item * $locale->native_language() |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
The language name for the locale in its native language, if any. |
558
|
|
|
|
|
|
|
|
559
|
|
|
|
|
|
|
=item * $locale->native_script() |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
The script name for the locale in its native language, if any. |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=item * $locale->native_territory() |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
The territory name for the locale in its native language, if any. |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=item * $locale->native_variant() |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
The variant name for the locale in its native language, if any. |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
=item * $locale->month_format_wide() |
572
|
|
|
|
|
|
|
|
573
|
|
|
|
|
|
|
Returns an array reference containing the wide format names of the months, with |
574
|
|
|
|
|
|
|
January as the first month. |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
=item * $locale->month_format_abbreviated() |
577
|
|
|
|
|
|
|
|
578
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated format names of the |
579
|
|
|
|
|
|
|
months, with January as the first month. |
580
|
|
|
|
|
|
|
|
581
|
|
|
|
|
|
|
=item * $locale->month_format_narrow() |
582
|
|
|
|
|
|
|
|
583
|
|
|
|
|
|
|
Returns an array reference containing the narrow format names of the months, |
584
|
|
|
|
|
|
|
with January as the first month. |
585
|
|
|
|
|
|
|
|
586
|
|
|
|
|
|
|
=item * $locale->month_stand_alone_wide() |
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
Returns an array reference containing the wide stand-alone names of the months, |
589
|
|
|
|
|
|
|
with January as the first month. |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
=item * $locale->month_stand_alone_abbreviated() |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated stand-alone names of the |
594
|
|
|
|
|
|
|
months, with January as the first month. |
595
|
|
|
|
|
|
|
|
596
|
|
|
|
|
|
|
=item * $locale->month_stand_alone_narrow() |
597
|
|
|
|
|
|
|
|
598
|
|
|
|
|
|
|
Returns an array reference containing the narrow stand-alone names of the |
599
|
|
|
|
|
|
|
months, with January as the first month. |
600
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
=item * $locale->day_format_wide() |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
Returns an array reference containing the wide format names of the days, with |
604
|
|
|
|
|
|
|
Monday as the first day. |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
=item * $locale->day_format_abbreviated() |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated format names of the days, |
609
|
|
|
|
|
|
|
with Monday as the first day. |
610
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
=item * $locale->day_format_narrow() |
612
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
Returns an array reference containing the narrow format names of the days, with |
614
|
|
|
|
|
|
|
Monday as the first day. |
615
|
|
|
|
|
|
|
|
616
|
|
|
|
|
|
|
=item * $locale->day_stand_alone_wide() |
617
|
|
|
|
|
|
|
|
618
|
|
|
|
|
|
|
Returns an array reference containing the wide stand-alone names of the days, |
619
|
|
|
|
|
|
|
with Monday as the first day. |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
=item * $locale->day_stand_alone_abbreviated() |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated stand-alone names of the |
624
|
|
|
|
|
|
|
days, with Monday as the first day. |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
=item * $locale->day_stand_alone_narrow() |
627
|
|
|
|
|
|
|
|
628
|
|
|
|
|
|
|
Returns an array reference containing the narrow stand-alone names of the days, |
629
|
|
|
|
|
|
|
with Monday as the first day. |
630
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=item * $locale->quarter_format_wide() |
632
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
Returns an array reference containing the wide format names of the quarters. |
634
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
=item * $locale->quarter_format_abbreviated() |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated format names of the |
638
|
|
|
|
|
|
|
quarters. |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
=item * $locale->quarter_format_narrow() |
641
|
|
|
|
|
|
|
|
642
|
|
|
|
|
|
|
Returns an array reference containing the narrow format names of the quarters. |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
=item * $locale->quarter_stand_alone_wide() |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
Returns an array reference containing the wide stand-alone names of the |
647
|
|
|
|
|
|
|
quarters. |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
=item * $locale->quarter_stand_alone_abbreviated() |
650
|
|
|
|
|
|
|
|
651
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated stand-alone names of the |
652
|
|
|
|
|
|
|
quarters. |
653
|
|
|
|
|
|
|
|
654
|
|
|
|
|
|
|
=item * $locale->quarter_stand_alone_narrow() |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
Returns an array reference containing the narrow stand-alone names of the |
657
|
|
|
|
|
|
|
quarters. |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
=item * $locale->era_wide() |
660
|
|
|
|
|
|
|
|
661
|
|
|
|
|
|
|
Returns an array reference containing the wide names of the eras, with "BCE" |
662
|
|
|
|
|
|
|
first. |
663
|
|
|
|
|
|
|
|
664
|
|
|
|
|
|
|
=item * $locale->era_abbreviated() |
665
|
|
|
|
|
|
|
|
666
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated names of the eras, with |
667
|
|
|
|
|
|
|
"BCE" first. |
668
|
|
|
|
|
|
|
|
669
|
|
|
|
|
|
|
=item * $locale->era_narrow() |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated names of the eras, with |
672
|
|
|
|
|
|
|
"BCE" first. However, most locales do not differ between the narrow and |
673
|
|
|
|
|
|
|
abbreviated length of the era. |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=item * $locale->am_pm_abbreviated() |
676
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
Returns an array reference containing the abbreviated names of "AM" and "PM". |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=item * $locale->date_format_long() |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=item * $locale->date_format_full() |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=item * $locale->date_format_medium() |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
=item * $locale->date_format_short() |
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
Returns the CLDR date pattern of the appropriate length. |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
=item * $locale->date_formats() |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
Returns a hash reference of CLDR date patterns for the date formats, where the |
692
|
|
|
|
|
|
|
keys are "full", "long", "medium", and "short". |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
=item * $locale->time_format_long() |
695
|
|
|
|
|
|
|
|
696
|
|
|
|
|
|
|
=item * $locale->time_format_full() |
697
|
|
|
|
|
|
|
|
698
|
|
|
|
|
|
|
=item * $locale->time_format_medium() |
699
|
|
|
|
|
|
|
|
700
|
|
|
|
|
|
|
=item * $locale->time_format_short() |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
Returns the CLDR date pattern of the appropriate length. |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
=item * $locale->time_formats() |
705
|
|
|
|
|
|
|
|
706
|
|
|
|
|
|
|
Returns a hash reference of CLDR date patterns for the time formats, where the |
707
|
|
|
|
|
|
|
keys are "full", "long", "medium", and "short". |
708
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
=item * $locale->datetime_format_long() |
710
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
=item * $locale->datetime_format_full() |
712
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
=item * $locale->datetime_format_medium() |
714
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
=item * $locale->datetime_format_short() |
716
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
Returns the CLDR date pattern of the appropriate length. |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
=item * $locale->datetime_formats() |
720
|
|
|
|
|
|
|
|
721
|
|
|
|
|
|
|
Returns a hash reference of CLDR date patterns for the datetime formats, where |
722
|
|
|
|
|
|
|
the keys are "full", "long", "medium", and "short". |
723
|
|
|
|
|
|
|
|
724
|
|
|
|
|
|
|
=item * $locale->date_format_default() |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
=item * $locale->time_format_default() |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
=item * $locale->datetime_format_default() |
729
|
|
|
|
|
|
|
|
730
|
|
|
|
|
|
|
Returns the default CLDR date pattern. The length of this format is based on |
731
|
|
|
|
|
|
|
the value of C<< $locale->default_date_format_length() >> and/or C<< |
732
|
|
|
|
|
|
|
$locale->default_time_format_length() >>. |
733
|
|
|
|
|
|
|
|
734
|
|
|
|
|
|
|
=item * $locale->default_date_format_length() |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
=item * $locale->default_time_format_length() |
737
|
|
|
|
|
|
|
|
738
|
|
|
|
|
|
|
Returns the default length for the format, one of "full", "long", "medium", or |
739
|
|
|
|
|
|
|
"short". |
740
|
|
|
|
|
|
|
|
741
|
|
|
|
|
|
|
=item * $locale->set_default_date_format_length() |
742
|
|
|
|
|
|
|
|
743
|
|
|
|
|
|
|
=item * $locale->set_default_time_format_length() |
744
|
|
|
|
|
|
|
|
745
|
|
|
|
|
|
|
Sets the default length for the format. This must be one of "full", "long", |
746
|
|
|
|
|
|
|
"medium", or "short". |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
=item * $locale->prefers_24_hour_time() |
749
|
|
|
|
|
|
|
|
750
|
|
|
|
|
|
|
Returns a boolean indicating the preferred hour format for this locale. |
751
|
|
|
|
|
|
|
|
752
|
|
|
|
|
|
|
=item * $locale->first_day_of_week() |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
Returns a number from 1 to 7 indicating the I<local> first day of the week, |
755
|
|
|
|
|
|
|
with Monday being 1 and Sunday being 7. For example, for a US locale this |
756
|
|
|
|
|
|
|
returns 7. |
757
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
=item * $locale->available_formats() |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
A list of format names, like "MMdd" or "yyyyMM". This should be the list |
761
|
|
|
|
|
|
|
directly supported by the subclass, not its parents. |
762
|
|
|
|
|
|
|
|
763
|
|
|
|
|
|
|
=item * $locale->format_for($key) |
764
|
|
|
|
|
|
|
|
765
|
|
|
|
|
|
|
Given a valid name, returns the CLDR date pattern for that thing, if one |
766
|
|
|
|
|
|
|
exists. |
767
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
=back |
769
|
|
|
|
|
|
|
|
770
|
|
|
|
|
|
|
=head1 SUPPORT |
771
|
|
|
|
|
|
|
|
772
|
|
|
|
|
|
|
See L<DateTime::Locale>. |
773
|
|
|
|
|
|
|
|
774
|
|
|
|
|
|
|
Bugs may be submitted at L<https://github.com/houseabsolute/DateTime-Locale/issues>. |
775
|
|
|
|
|
|
|
|
776
|
|
|
|
|
|
|
There is a mailing list available for users of this distribution, |
777
|
|
|
|
|
|
|
L<mailto:datetime@perl.org>. |
778
|
|
|
|
|
|
|
|
779
|
|
|
|
|
|
|
=head1 SOURCE |
780
|
|
|
|
|
|
|
|
781
|
|
|
|
|
|
|
The source code repository for DateTime-Locale can be found at L<https://github.com/houseabsolute/DateTime-Locale>. |
782
|
|
|
|
|
|
|
|
783
|
|
|
|
|
|
|
=head1 AUTHOR |
784
|
|
|
|
|
|
|
|
785
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
786
|
|
|
|
|
|
|
|
787
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
788
|
|
|
|
|
|
|
|
789
|
|
|
|
|
|
|
This software is copyright (c) 2003 - 2022 by Dave Rolsky. |
790
|
|
|
|
|
|
|
|
791
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
792
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
The full text of the license can be found in the |
795
|
|
|
|
|
|
|
F<LICENSE> file included with this distribution. |
796
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
=cut |