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.39
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 These methods return a reference to the data stored in the locale
97 object. If you change this reference's contents, this will affect the
98 data in the locale object! You should clone the data first if you want
99 to modify it.
100
101 $locale->date_format_full
102 $locale->date_format_long
103 $locale->date_format_medium
104 $locale->date_format_short
105 $locale->time_format_full
106 $locale->time_format_long
107 $locale->time_format_medium
108 $locale->time_format_short
109 $locale->datetime_format_full
110 $locale->datetime_format_long
111 $locale->datetime_format_medium
112 $locale->datetime_format_short
113 These methods return strings appropriate for the
114 "DateTime->format_cldr" method.
115
116 $locale->format_for($name)
117 These are accessed by passing a name to "$locale->format_for(...)",
118 where the name is a CLDR-style format specifier.
119
120 The return value is a string suitable for passing to
121 "$dt->format_cldr", so you can do something like this:
122
123 print $dt->format_cldr( $dt->locale->format_for('MMMdd') )
124
125 which for the "en" locale would print out something like "08 Jul".
126
127 Note that the localization may also include additional text specific to
128 the locale. For example, the "MMMMd" format for the "zh" locale
129 includes the Chinese characters for "day" (日) and month (月), so you
130 get something like "8月23日".
131
132 $locale->available_formats
133 This should return a list of all the format names that could be passed
134 to "$locale->format_for".
135
136 See the documentation for individual locales for details and examples
137 of these formats. The format names that are available vary by locale.
138
139 $locale->glibc_datetime_format
140 $locale->glibc_date_format
141 $locale->glibc_date_1_format
142 $locale->glibc_time_format
143 $locale->glibc_time_12_format
144 These methods return strings appropriate for the "DateTime->strftime"
145 method. However, you are strongly encouraged to use the other format
146 methods, which use the CLDR format data. They are primarily included
147 for the benefit for DateTime::Format::Strptime.
148
149 $locale->version
150 The CLDR version from which this locale was generated.
151
152 $locale->prefers_24_hour_time
153 Returns a boolean indicating whether or not the locale prefers 24-hour
154 time.
155
156 $locale->first_day_of_week
157 Returns a number from 1 to 7 indicating the local first day of the
158 week, with Monday being 1 and Sunday being 7.
159
160 $locale->locale_data
161 Returns a clone of the original data used to create this locale as a
162 hash. This is here to facilitate creating custom locales via
163 "DateTime::Locale-"register_data_locale>.
164
166 Bugs may be submitted at
167 <https://github.com/houseabsolute/DateTime-Locale/issues>.
168
169 There is a mailing list available for users of this distribution,
170 <mailto:datetime@perl.org>.
171
173 The source code repository for DateTime-Locale can be found at
174 <https://github.com/houseabsolute/DateTime-Locale>.
175
177 Dave Rolsky <autarch@urth.org>
178
180 This software is copyright (c) 2003 - 2023 by Dave Rolsky.
181
182 This is free software; you can redistribute it and/or modify it under
183 the same terms as the Perl 5 programming language system itself.
184
185 The full text of the license can be found in the LICENSE file included
186 with this distribution.
187
188
189
190perl v5.36.1 2023-05-29 DateTime::Locale::FromData(3)