1DateTime::Locale::FromDUastear(3C)ontributed Perl DocumeDnattaetTiiomne::Locale::FromData(3)
2
3
4
6 DateTime::Locale::FromData - Class for locale objects instantiated from
7 pre-defined data
8
10 version 1.25
11
13 my $locale = DateTime::Locale::FromData->new(%lots_of_data)
14
16 This class is used to represent locales instantiated from the data in
17 the DateTime::Locale::Data module.
18
20 This class provides the following methods:
21
22 $locale->code
23 The complete locale id, something like "en-US".
24
25 $locale->language_code
26 The language portion of the code, like "en".
27
28 $locale->script_code
29 The script portion of the code, like "Hant".
30
31 $locale->territory_code
32 The territory portion of the code, like "US".
33
34 $locale->variant_code
35 The variant portion of the code, like "POSIX".
36
37 $locale->name
38 The locale's complete name, which always includes at least a language
39 component, plus optional territory and variant components. Something
40 like "English United States". The value returned will always be in
41 English.
42
43 $locale->language
44 $locale->script
45 $locale->territory
46 $locale->variant
47 The relevant component from the locale's complete name, like "English"
48 or "United States".
49
50 $locale->native_name
51 The locale's complete name in localized form as a UTF-8 string.
52
53 $locale->native_language
54 $locale->native_script
55 $locale->native_territory
56 $locale->native_variant
57 The relevant component from the locale's complete native name as a
58 UTF-8 string.
59
60 $locale->month_format_wide
61 $locale->month_format_abbreviated
62 $locale->month_format_narrow
63 $locale->month_stand_alone_wide
64 $locale->month_stand_alone_abbreviated
65 $locale->month_stand_alone_narrow
66 $locale->day_format_wide
67 $locale->day_format_abbreviated
68 $locale->day_format_narrow
69 $locale->day_stand_alone_wide
70 $locale->day_stand_alone_abbreviated
71 $locale->day_stand_alone_narrow
72 $locale->quarter_format_wide
73 $locale->quarter_format_abbreviated
74 $locale->quarter_format_narrow
75 $locale->quarter_stand_alone_wide
76 $locale->quarter_stand_alone_abbreviated
77 $locale->quarter_stand_alone_narrow
78 $locale->am_pm_abbreviated
79 $locale->era_wide
80 $locale->era_abbreviated
81 $locale->era_narrow
82 These methods all return an array reference containing the specified
83 data.
84
85 The methods with "format" in the name should return strings that can be
86 used a part of a string, like "the month of July". The stand alone
87 values are for use in things like calendars as opposed to a sentence.
88
89 The narrow forms may not be unique (for example, in the day column
90 heading for a calendar it's okay to have "T" for both Tuesday and
91 Thursday).
92
93 The wide name should always be the full name of thing in question. The
94 narrow name should be just one or two characters.
95
96 $locale->date_format_full
97 $locale->date_format_long
98 $locale->date_format_medium
99 $locale->date_format_short
100 $locale->time_format_full
101 $locale->time_format_long
102 $locale->time_format_medium
103 $locale->time_format_short
104 $locale->datetime_format_full
105 $locale->datetime_format_long
106 $locale->datetime_format_medium
107 $locale->datetime_format_short
108 These methods return strings appropriate for the
109 "DateTime->format_cldr" method.
110
111 $locale->format_for($name)
112 These are accessed by passing a name to "$locale->format_for(...)",
113 where the name is a CLDR-style format specifier.
114
115 The return value is a string suitable for passing to
116 "$dt->format_cldr", so you can do something like this:
117
118 print $dt->format_cldr( $dt->locale->format_for('MMMdd') )
119
120 which for the "en" locale would print out something like "08 Jul".
121
122 Note that the localization may also include additional text specific to
123 the locale. For example, the "MMMMd" format for the "zh" locale
124 includes the Chinese characters for "day" (日) and month (月), so you
125 get something like "8月23日".
126
127 $locale->available_formats
128 This should return a list of all the format names that could be passed
129 to "$locale->format_for".
130
131 See the documentation for individual locales for details and examples
132 of these formats. The format names that are available vary by locale.
133
134 $locale->glibc_datetime_format
135 $locale->glibc_date_format
136 $locale->glibc_date_1_format
137 $locale->glibc_time_format
138 $locale->glibc_time_12_format
139 These methods return strings appropriate for the "DateTime->strftime"
140 method. However, you are strongly encouraged to use the other format
141 methods, which use the CLDR format data. They are primarily included
142 for the benefit for DateTime::Format::Strptime.
143
144 $locale->version
145 The CLDR version from which this locale was generated.
146
147 $locale->prefers_24_hour_time
148 Returns a boolean indicating whether or not the locale prefers 24-hour
149 time.
150
151 $locale->first_day_of_week
152 Returns a number from 1 to 7 indicating the local first day of the
153 week, with Monday being 1 and Sunday being 7.
154
155 $locale->locale_data
156 Returns the original data used to create this locale as a hash. This is
157 here to facilitate creating custom locale that via
158 "DateTime::Locale-"register_data_locale>.
159
161 Bugs may be submitted at
162 <https://github.com/houseabsolute/DateTime-Locale/issues>.
163
164 There is a mailing list available for users of this distribution,
165 <mailto:datetime@perl.org>.
166
167 I am also usually active on IRC as 'autarch' on "irc://irc.perl.org".
168
170 The source code repository for DateTime-Locale can be found at
171 <https://github.com/houseabsolute/DateTime-Locale>.
172
174 Dave Rolsky <autarch@urth.org>
175
177 This software is copyright (c) 2003 - 2019 by Dave Rolsky.
178
179 This is free software; you can redistribute it and/or modify it under
180 the same terms as the Perl 5 programming language system itself.
181
182 The full text of the license can be found in the LICENSE file included
183 with this distribution.
184
185
186
187perl v5.30.0 2019-10-10 DateTime::Locale::FromData(3)