| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "I18N::Langinfo 3perl" |
| 58 |
.TH I18N::Langinfo 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
I18N::Langinfo \- query locale information |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 1 |
| 68 |
\& use I18N::Langinfo; |
| 69 |
.Ve |
| 70 |
.SH DESCRIPTION |
| 71 |
.IX Header "DESCRIPTION" |
| 72 |
The \fBlanginfo()\fR function queries various locale information that can be |
| 73 |
used to localize output and user interfaces. It uses the current underlying |
| 74 |
locale, regardless of whether or not it was called from within the scope of |
| 75 |
\&\f(CW\*(C`use\ locale\*(C'\fR. The \fBlanginfo()\fR function requires |
| 76 |
one numeric argument that identifies the locale constant to query: |
| 77 |
if no argument is supplied, \f(CW$_\fR is used. The numeric constants |
| 78 |
appropriate to be used as arguments are exportable from I18N::Langinfo. |
| 79 |
.PP |
| 80 |
The following example will import the \fBlanginfo()\fR function itself and |
| 81 |
three constants to be used as arguments to \fBlanginfo()\fR: a constant for |
| 82 |
the abbreviated first day of the week (the numbering starts from |
| 83 |
Sunday = 1) and two more constants for the affirmative and negative |
| 84 |
answers for a yes/no question in the current locale. |
| 85 |
.PP |
| 86 |
.Vb 1 |
| 87 |
\& use I18N::Langinfo qw(langinfo ABDAY_1 YESSTR NOSTR); |
| 88 |
\& |
| 89 |
\& my ($abday_1, $yesstr, $nostr) = |
| 90 |
\& map { langinfo($_) } (ABDAY_1, YESSTR, NOSTR); |
| 91 |
\& |
| 92 |
\& print "$abday_1? [$yesstr/$nostr] "; |
| 93 |
.Ve |
| 94 |
.PP |
| 95 |
In other words, in the "C" (or English) locale the above will probably |
| 96 |
print something like: |
| 97 |
.PP |
| 98 |
.Vb 1 |
| 99 |
\& Sun? [yes/no] |
| 100 |
.Ve |
| 101 |
.PP |
| 102 |
but under a French locale |
| 103 |
.PP |
| 104 |
.Vb 1 |
| 105 |
\& dim? [oui/non] |
| 106 |
.Ve |
| 107 |
.PP |
| 108 |
The usually available constants are as follows. |
| 109 |
.IP \(bu 4 |
| 110 |
For abbreviated and full length days of the week and months of the year: |
| 111 |
.Sp |
| 112 |
.Vb 6 |
| 113 |
\& ABDAY_1 ABDAY_2 ABDAY_3 ABDAY_4 ABDAY_5 ABDAY_6 ABDAY_7 |
| 114 |
\& ABMON_1 ABMON_2 ABMON_3 ABMON_4 ABMON_5 ABMON_6 |
| 115 |
\& ABMON_7 ABMON_8 ABMON_9 ABMON_10 ABMON_11 ABMON_12 |
| 116 |
\& DAY_1 DAY_2 DAY_3 DAY_4 DAY_5 DAY_6 DAY_7 |
| 117 |
\& MON_1 MON_2 MON_3 MON_4 MON_5 MON_6 |
| 118 |
\& MON_7 MON_8 MON_9 MON_10 MON_11 MON_12 |
| 119 |
.Ve |
| 120 |
.IP \(bu 4 |
| 121 |
For the date-time, date, and time formats used by the \fBstrftime()\fR function |
| 122 |
(see POSIX): |
| 123 |
.Sp |
| 124 |
.Vb 1 |
| 125 |
\& D_T_FMT D_FMT T_FMT |
| 126 |
.Ve |
| 127 |
.IP \(bu 4 |
| 128 |
For the locales for which it makes sense to have ante meridiem and post |
| 129 |
meridiem time formats: |
| 130 |
.Sp |
| 131 |
.Vb 1 |
| 132 |
\& AM_STR PM_STR T_FMT_AMPM |
| 133 |
.Ve |
| 134 |
.IP \(bu 4 |
| 135 |
For the character code set being used (such as "ISO8859\-1", "cp850", |
| 136 |
"koi8\-r", "sjis", "utf8", etc.): |
| 137 |
.Sp |
| 138 |
.Vb 1 |
| 139 |
\& CODESET |
| 140 |
.Ve |
| 141 |
.IP \(bu 4 |
| 142 |
For the symbol or string of characters that indicates a number is a monetary |
| 143 |
value: |
| 144 |
.Sp |
| 145 |
.Vb 1 |
| 146 |
\& CRNCYSTR |
| 147 |
.Ve |
| 148 |
.Sp |
| 149 |
An example is the dollar sign \f(CW\*(C`$\*(C'\fR. Some locales not associated with |
| 150 |
particular locations may have an empty currency string. (The C locale is |
| 151 |
one.) Otherwise, the return of this is always prefixed by one of these three |
| 152 |
characters: |
| 153 |
.RS 4 |
| 154 |
.ie n .IP """\-""" 4 |
| 155 |
.el .IP \f(CW\-\fR 4 |
| 156 |
.IX Item "-" |
| 157 |
indicates that in this locale, the string precedes the numeric value, as in a |
| 158 |
U.S. locale: \f(CW\*(C`$9.95\*(C'\fR. |
| 159 |
.ie n .IP """+""" 4 |
| 160 |
.el .IP \f(CW+\fR 4 |
| 161 |
.IX Item "+" |
| 162 |
indicates that in this locale, the string follows the numeric value, like |
| 163 |
\&\f(CW\*(C`9.95USD\*(C'\fR. |
| 164 |
.ie n .IP """.""" 4 |
| 165 |
.el .IP \f(CW.\fR 4 |
| 166 |
.IX Item "." |
| 167 |
indicates that in this locale, the string replaces the radix character, like |
| 168 |
\&\f(CW\*(C`9$95\*(C'\fR. |
| 169 |
.RE |
| 170 |
.RS 4 |
| 171 |
.RE |
| 172 |
.IP \(bu 4 |
| 173 |
For the radix character used between the integer and the fractional part of |
| 174 |
decimal numbers, and the group separator string for large-ish floating point |
| 175 |
numbers (yes, these are redundant with |
| 176 |
\&\fBPOSIX::localeconv()\fR): |
| 177 |
.Sp |
| 178 |
.Vb 1 |
| 179 |
\& RADIXCHAR THOUSEP |
| 180 |
.Ve |
| 181 |
.IP \(bu 4 |
| 182 |
For any alternate digits used in this locale besides the standard \f(CW0..9\fR: |
| 183 |
.Sp |
| 184 |
.Vb 1 |
| 185 |
\& ALT_DIGITS |
| 186 |
.Ve |
| 187 |
.Sp |
| 188 |
This returns a sequence of alternate numeric reprsesentations for the numbers |
| 189 |
\&\f(CW0\fR ... up to \f(CW99\fR. The representations are returned in a single string, |
| 190 |
with a semi-colon \f(CW\*(C`;\*(C'\fR used to separated the individual ones. |
| 191 |
.Sp |
| 192 |
Most locales don't have alternate digits, so the string will be empty. |
| 193 |
.Sp |
| 194 |
To access this data conveniently, you could do something like |
| 195 |
.Sp |
| 196 |
.Vb 2 |
| 197 |
\& use I18N::Langinfo qw(langinfo ALT_DIGITS); |
| 198 |
\& my @alt_digits = split \*(Aq;\*(Aq, langinfo(ALT_DIGITS); |
| 199 |
.Ve |
| 200 |
.Sp |
| 201 |
The array \f(CW@alt_digits\fR will contain 0 elements if the current locale doesn't |
| 202 |
have alternate digits specified for it. Otherwise, it will have as many |
| 203 |
elements as the locale defines, with \f(CW\*(C`[0]\*(C'\fR containing the alternate digit for |
| 204 |
zero; \f(CW\*(C`[1]\*(C'\fR for one; and so forth, up to potentially \f(CW\*(C`[99]\*(C'\fR for the |
| 205 |
alternate representation of ninety-nine. |
| 206 |
.Sp |
| 207 |
Be aware that the alternate representation in some locales for the numbers |
| 208 |
0..9 will have a leading alternate-zero, so would look like the equivalent of |
| 209 |
00..09. |
| 210 |
.Sp |
| 211 |
Running this program |
| 212 |
.Sp |
| 213 |
.Vb 4 |
| 214 |
\& use I18N::Langinfo qw(langinfo ALT_DIGITS); |
| 215 |
\& my @alt_digits = split \*(Aq;\*(Aq, langinfo(ALT_DIGITS); |
| 216 |
\& splice @alt_digits, 15; |
| 217 |
\& print join " ", @alt_digits, "\en"; |
| 218 |
.Ve |
| 219 |
.Sp |
| 220 |
on a Japanese locale yields |
| 221 |
.Sp |
| 222 |
\&\f(CW\*(C`〇\ 一\ 二\ 三\ 四\ 五\ 六\ 七\ 八\ 九\ 十\ 十一\ 十二\ 十三\ 十四\*(C'\fR |
| 223 |
.Sp |
| 224 |
on some platforms. |
| 225 |
.IP \(bu 4 |
| 226 |
For the affirmative and negative responses and expressions: |
| 227 |
.Sp |
| 228 |
.Vb 1 |
| 229 |
\& YESSTR YESEXPR NOSTR NOEXPR |
| 230 |
.Ve |
| 231 |
.IP \(bu 4 |
| 232 |
For the eras based on typically some ruler, such as the Japanese Emperor |
| 233 |
(naturally only defined in the appropriate locales): |
| 234 |
.Sp |
| 235 |
.Vb 1 |
| 236 |
\& ERA ERA_D_FMT ERA_D_T_FMT ERA_T_FMT |
| 237 |
.Ve |
| 238 |
.PP |
| 239 |
In addition, Linux boxes have extra items, as follows. (When called from |
| 240 |
other platform types, these return a stub value, of not much use.) |
| 241 |
.ie n .IP """_NL_ADDRESS_POSTAL_FMT""" 4 |
| 242 |
.el .IP \f(CW_NL_ADDRESS_POSTAL_FMT\fR 4 |
| 243 |
.IX Item "_NL_ADDRESS_POSTAL_FMT" |
| 244 |
.PD 0 |
| 245 |
.ie n .IP """_NL_ADDRESS_COUNTRY_NAME""" 4 |
| 246 |
.el .IP \f(CW_NL_ADDRESS_COUNTRY_NAME\fR 4 |
| 247 |
.IX Item "_NL_ADDRESS_COUNTRY_NAME" |
| 248 |
.ie n .IP """_NL_ADDRESS_COUNTRY_POST""" 4 |
| 249 |
.el .IP \f(CW_NL_ADDRESS_COUNTRY_POST\fR 4 |
| 250 |
.IX Item "_NL_ADDRESS_COUNTRY_POST" |
| 251 |
.ie n .IP """_NL_ADDRESS_COUNTRY_AB2""" 4 |
| 252 |
.el .IP \f(CW_NL_ADDRESS_COUNTRY_AB2\fR 4 |
| 253 |
.IX Item "_NL_ADDRESS_COUNTRY_AB2" |
| 254 |
.ie n .IP """_NL_ADDRESS_COUNTRY_AB3""" 4 |
| 255 |
.el .IP \f(CW_NL_ADDRESS_COUNTRY_AB3\fR 4 |
| 256 |
.IX Item "_NL_ADDRESS_COUNTRY_AB3" |
| 257 |
.ie n .IP """_NL_ADDRESS_COUNTRY_CAR""" 4 |
| 258 |
.el .IP \f(CW_NL_ADDRESS_COUNTRY_CAR\fR 4 |
| 259 |
.IX Item "_NL_ADDRESS_COUNTRY_CAR" |
| 260 |
.ie n .IP """_NL_ADDRESS_COUNTRY_NUM""" 4 |
| 261 |
.el .IP \f(CW_NL_ADDRESS_COUNTRY_NUM\fR 4 |
| 262 |
.IX Item "_NL_ADDRESS_COUNTRY_NUM" |
| 263 |
.ie n .IP """_NL_ADDRESS_COUNTRY_ISBN""" 4 |
| 264 |
.el .IP \f(CW_NL_ADDRESS_COUNTRY_ISBN\fR 4 |
| 265 |
.IX Item "_NL_ADDRESS_COUNTRY_ISBN" |
| 266 |
.ie n .IP """_NL_ADDRESS_LANG_NAME""" 4 |
| 267 |
.el .IP \f(CW_NL_ADDRESS_LANG_NAME\fR 4 |
| 268 |
.IX Item "_NL_ADDRESS_LANG_NAME" |
| 269 |
.ie n .IP """_NL_ADDRESS_LANG_AB""" 4 |
| 270 |
.el .IP \f(CW_NL_ADDRESS_LANG_AB\fR 4 |
| 271 |
.IX Item "_NL_ADDRESS_LANG_AB" |
| 272 |
.ie n .IP """_NL_ADDRESS_LANG_TERM""" 4 |
| 273 |
.el .IP \f(CW_NL_ADDRESS_LANG_TERM\fR 4 |
| 274 |
.IX Item "_NL_ADDRESS_LANG_TERM" |
| 275 |
.ie n .IP """_NL_ADDRESS_LANG_LIB""" 4 |
| 276 |
.el .IP \f(CW_NL_ADDRESS_LANG_LIB\fR 4 |
| 277 |
.IX Item "_NL_ADDRESS_LANG_LIB" |
| 278 |
.PD |
| 279 |
On Linux boxes, these return information about the country for the current |
| 280 |
locale. Further information is found in \fIlanginfo.h\fR |
| 281 |
.ie n .IP """_NL_IDENTIFICATION_TITLE""" 4 |
| 282 |
.el .IP \f(CW_NL_IDENTIFICATION_TITLE\fR 4 |
| 283 |
.IX Item "_NL_IDENTIFICATION_TITLE" |
| 284 |
.PD 0 |
| 285 |
.ie n .IP """_NL_IDENTIFICATION_SOURCE""" 4 |
| 286 |
.el .IP \f(CW_NL_IDENTIFICATION_SOURCE\fR 4 |
| 287 |
.IX Item "_NL_IDENTIFICATION_SOURCE" |
| 288 |
.ie n .IP """_NL_IDENTIFICATION_ADDRESS""" 4 |
| 289 |
.el .IP \f(CW_NL_IDENTIFICATION_ADDRESS\fR 4 |
| 290 |
.IX Item "_NL_IDENTIFICATION_ADDRESS" |
| 291 |
.ie n .IP """_NL_IDENTIFICATION_CONTACT""" 4 |
| 292 |
.el .IP \f(CW_NL_IDENTIFICATION_CONTACT\fR 4 |
| 293 |
.IX Item "_NL_IDENTIFICATION_CONTACT" |
| 294 |
.ie n .IP """_NL_IDENTIFICATION_EMAIL""" 4 |
| 295 |
.el .IP \f(CW_NL_IDENTIFICATION_EMAIL\fR 4 |
| 296 |
.IX Item "_NL_IDENTIFICATION_EMAIL" |
| 297 |
.ie n .IP """_NL_IDENTIFICATION_TEL""" 4 |
| 298 |
.el .IP \f(CW_NL_IDENTIFICATION_TEL\fR 4 |
| 299 |
.IX Item "_NL_IDENTIFICATION_TEL" |
| 300 |
.ie n .IP """_NL_IDENTIFICATION_FAX""" 4 |
| 301 |
.el .IP \f(CW_NL_IDENTIFICATION_FAX\fR 4 |
| 302 |
.IX Item "_NL_IDENTIFICATION_FAX" |
| 303 |
.ie n .IP """_NL_IDENTIFICATION_LANGUAGE""" 4 |
| 304 |
.el .IP \f(CW_NL_IDENTIFICATION_LANGUAGE\fR 4 |
| 305 |
.IX Item "_NL_IDENTIFICATION_LANGUAGE" |
| 306 |
.ie n .IP """_NL_IDENTIFICATION_TERRITORY""" 4 |
| 307 |
.el .IP \f(CW_NL_IDENTIFICATION_TERRITORY\fR 4 |
| 308 |
.IX Item "_NL_IDENTIFICATION_TERRITORY" |
| 309 |
.ie n .IP """_NL_IDENTIFICATION_AUDIENCE""" 4 |
| 310 |
.el .IP \f(CW_NL_IDENTIFICATION_AUDIENCE\fR 4 |
| 311 |
.IX Item "_NL_IDENTIFICATION_AUDIENCE" |
| 312 |
.ie n .IP """_NL_IDENTIFICATION_APPLICATION""" 4 |
| 313 |
.el .IP \f(CW_NL_IDENTIFICATION_APPLICATION\fR 4 |
| 314 |
.IX Item "_NL_IDENTIFICATION_APPLICATION" |
| 315 |
.ie n .IP """_NL_IDENTIFICATION_ABBREVIATION""" 4 |
| 316 |
.el .IP \f(CW_NL_IDENTIFICATION_ABBREVIATION\fR 4 |
| 317 |
.IX Item "_NL_IDENTIFICATION_ABBREVIATION" |
| 318 |
.ie n .IP """_NL_IDENTIFICATION_REVISION""" 4 |
| 319 |
.el .IP \f(CW_NL_IDENTIFICATION_REVISION\fR 4 |
| 320 |
.IX Item "_NL_IDENTIFICATION_REVISION" |
| 321 |
.ie n .IP """_NL_IDENTIFICATION_DATE""" 4 |
| 322 |
.el .IP \f(CW_NL_IDENTIFICATION_DATE\fR 4 |
| 323 |
.IX Item "_NL_IDENTIFICATION_DATE" |
| 324 |
.ie n .IP """_NL_IDENTIFICATION_CATEGORY""" 4 |
| 325 |
.el .IP \f(CW_NL_IDENTIFICATION_CATEGORY\fR 4 |
| 326 |
.IX Item "_NL_IDENTIFICATION_CATEGORY" |
| 327 |
.PD |
| 328 |
On Linux boxes, these return meta information about the current locale, |
| 329 |
such as how to get in touch with its maintainers. |
| 330 |
Further information is found in \fIlanginfo.h\fR |
| 331 |
.ie n .IP """_NL_MEASUREMENT_MEASUREMENT""" 4 |
| 332 |
.el .IP \f(CW_NL_MEASUREMENT_MEASUREMENT\fR 4 |
| 333 |
.IX Item "_NL_MEASUREMENT_MEASUREMENT" |
| 334 |
On Linux boxes, it returns 1 if the metric system of measurement prevails in |
| 335 |
the locale; or 2 if US customary units prevail. |
| 336 |
.ie n .IP """_NL_NAME_NAME_FMT""" 4 |
| 337 |
.el .IP \f(CW_NL_NAME_NAME_FMT\fR 4 |
| 338 |
.IX Item "_NL_NAME_NAME_FMT" |
| 339 |
.PD 0 |
| 340 |
.ie n .IP """_NL_NAME_NAME_GEN""" 4 |
| 341 |
.el .IP \f(CW_NL_NAME_NAME_GEN\fR 4 |
| 342 |
.IX Item "_NL_NAME_NAME_GEN" |
| 343 |
.ie n .IP """_NL_NAME_NAME_MR""" 4 |
| 344 |
.el .IP \f(CW_NL_NAME_NAME_MR\fR 4 |
| 345 |
.IX Item "_NL_NAME_NAME_MR" |
| 346 |
.ie n .IP """_NL_NAME_NAME_MRS""" 4 |
| 347 |
.el .IP \f(CW_NL_NAME_NAME_MRS\fR 4 |
| 348 |
.IX Item "_NL_NAME_NAME_MRS" |
| 349 |
.ie n .IP """_NL_NAME_NAME_MISS""" 4 |
| 350 |
.el .IP \f(CW_NL_NAME_NAME_MISS\fR 4 |
| 351 |
.IX Item "_NL_NAME_NAME_MISS" |
| 352 |
.ie n .IP """_NL_NAME_NAME_MS""" 4 |
| 353 |
.el .IP \f(CW_NL_NAME_NAME_MS\fR 4 |
| 354 |
.IX Item "_NL_NAME_NAME_MS" |
| 355 |
.PD |
| 356 |
On Linux boxes, these return information about how names are formatted and |
| 357 |
the personal salutations used in the current locale. Further information |
| 358 |
is found in \fBlocale\fR\|(7) and \fIlanginfo.h\fR |
| 359 |
.ie n .IP """_NL_PAPER_HEIGHT""" 4 |
| 360 |
.el .IP \f(CW_NL_PAPER_HEIGHT\fR 4 |
| 361 |
.IX Item "_NL_PAPER_HEIGHT" |
| 362 |
.PD 0 |
| 363 |
.ie n .IP """_NL_PAPER_WIDTH""" 4 |
| 364 |
.el .IP \f(CW_NL_PAPER_WIDTH\fR 4 |
| 365 |
.IX Item "_NL_PAPER_WIDTH" |
| 366 |
.PD |
| 367 |
On Linux boxes, these return the standard size of sheets of paper (in |
| 368 |
millimeters) in the current locale. |
| 369 |
.ie n .IP """_NL_TELEPHONE_TEL_INT_FMT""" 4 |
| 370 |
.el .IP \f(CW_NL_TELEPHONE_TEL_INT_FMT\fR 4 |
| 371 |
.IX Item "_NL_TELEPHONE_TEL_INT_FMT" |
| 372 |
.PD 0 |
| 373 |
.ie n .IP """_NL_TELEPHONE_TEL_DOM_FMT""" 4 |
| 374 |
.el .IP \f(CW_NL_TELEPHONE_TEL_DOM_FMT\fR 4 |
| 375 |
.IX Item "_NL_TELEPHONE_TEL_DOM_FMT" |
| 376 |
.ie n .IP """_NL_TELEPHONE_INT_SELECT""" 4 |
| 377 |
.el .IP \f(CW_NL_TELEPHONE_INT_SELECT\fR 4 |
| 378 |
.IX Item "_NL_TELEPHONE_INT_SELECT" |
| 379 |
.ie n .IP """_NL_TELEPHONE_INT_PREFIX""" 4 |
| 380 |
.el .IP \f(CW_NL_TELEPHONE_INT_PREFIX\fR 4 |
| 381 |
.IX Item "_NL_TELEPHONE_INT_PREFIX" |
| 382 |
.PD |
| 383 |
On Linux boxes, these return information about how telephone numbers are |
| 384 |
formatted (both domestically and international calling) in the current locale. |
| 385 |
Further information is found in \fIlanginfo.h\fR |
| 386 |
.ie n .SS "For systems without ""nl_langinfo""" |
| 387 |
.el .SS "For systems without \f(CWnl_langinfo\fP" |
| 388 |
.IX Subsection "For systems without nl_langinfo" |
| 389 |
This module originally was just a wrapper for the libc \f(CW\*(C`nl_langinfo\*(C'\fR |
| 390 |
function, and did not work on systems lacking it, such as Windows. |
| 391 |
.PP |
| 392 |
Starting in Perl 5.28, this module works on all platforms. When |
| 393 |
\&\f(CW\*(C`nl_langinfo\*(C'\fR is not available, it uses various methods to construct |
| 394 |
what that function, if present, would return. But there are potential |
| 395 |
glitches. These are the items that could be different: |
| 396 |
.ie n .IP """ERA""" 4 |
| 397 |
.el .IP \f(CWERA\fR 4 |
| 398 |
.IX Item "ERA" |
| 399 |
Unimplemented, so returns \f(CW""\fR. |
| 400 |
.ie n .IP """CODESET""" 4 |
| 401 |
.el .IP \f(CWCODESET\fR 4 |
| 402 |
.IX Item "CODESET" |
| 403 |
This should work properly for Windows platforms. On almost all other modern |
| 404 |
platforms, it will reliably return "UTF\-8" if that is the code set. |
| 405 |
Otherwise, it depends on the locale's name. If that is of the form |
| 406 |
\&\f(CW\*(C`foo.bar\*(C'\fR, it will assume \f(CW\*(C`bar\*(C'\fR is the code set; and it also knows about the |
| 407 |
two locales "C" and "POSIX". If none of those apply it returns \f(CW""\fR. |
| 408 |
.ie n .IP """YESEXPR""" 4 |
| 409 |
.el .IP \f(CWYESEXPR\fR 4 |
| 410 |
.IX Item "YESEXPR" |
| 411 |
.PD 0 |
| 412 |
.ie n .IP """YESSTR""" 4 |
| 413 |
.el .IP \f(CWYESSTR\fR 4 |
| 414 |
.IX Item "YESSTR" |
| 415 |
.ie n .IP """NOEXPR""" 4 |
| 416 |
.el .IP \f(CWNOEXPR\fR 4 |
| 417 |
.IX Item "NOEXPR" |
| 418 |
.ie n .IP """NOSTR""" 4 |
| 419 |
.el .IP \f(CWNOSTR\fR 4 |
| 420 |
.IX Item "NOSTR" |
| 421 |
.PD |
| 422 |
Only the values for English are returned. \f(CW\*(C`YESSTR\*(C'\fR and \f(CW\*(C`NOSTR\*(C'\fR have been |
| 423 |
removed from POSIX 2008, and are retained here for backwards compatibility. |
| 424 |
Your platform's \f(CW\*(C`nl_langinfo\*(C'\fR may not support them. |
| 425 |
.ie n .IP """ALT_DIGITS""" 4 |
| 426 |
.el .IP \f(CWALT_DIGITS\fR 4 |
| 427 |
.IX Item "ALT_DIGITS" |
| 428 |
On systems with a \f(CWstrftime(3)\fR that recognizes the POSIX-defined \f(CW%O\fR |
| 429 |
format modifier (not Windows), perl tries hard to return these. The result |
| 430 |
likely will go as high as what \f(CWnl_langinfo()\fR would return, but not |
| 431 |
necessarily; and the numbers from \f(CW0..9\fR will always be stripped of leading |
| 432 |
zeros. |
| 433 |
.Sp |
| 434 |
Without \f(CW%O\fR, an empty string is always returned. |
| 435 |
.ie n .IP """D_FMT""" 4 |
| 436 |
.el .IP \f(CWD_FMT\fR 4 |
| 437 |
.IX Item "D_FMT" |
| 438 |
Always evaluates to \f(CW%x\fR, the locale's appropriate date representation. |
| 439 |
.ie n .IP """T_FMT""" 4 |
| 440 |
.el .IP \f(CWT_FMT\fR 4 |
| 441 |
.IX Item "T_FMT" |
| 442 |
Always evaluates to \f(CW%X\fR, the locale's appropriate time representation. |
| 443 |
.ie n .IP """D_T_FMT""" 4 |
| 444 |
.el .IP \f(CWD_T_FMT\fR 4 |
| 445 |
.IX Item "D_T_FMT" |
| 446 |
Always evaluates to \f(CW%c\fR, the locale's appropriate date and time |
| 447 |
representation. |
| 448 |
.ie n .IP """CRNCYSTR""" 4 |
| 449 |
.el .IP \f(CWCRNCYSTR\fR 4 |
| 450 |
.IX Item "CRNCYSTR" |
| 451 |
The return may be incorrect for those rare locales where the currency symbol |
| 452 |
replaces the radix character. If you have examples of it needing to work |
| 453 |
differently, please file a report at <https://github.com/Perl/perl5/issues>. |
| 454 |
.ie n .IP """ERA_D_FMT""" 4 |
| 455 |
.el .IP \f(CWERA_D_FMT\fR 4 |
| 456 |
.IX Item "ERA_D_FMT" |
| 457 |
.PD 0 |
| 458 |
.ie n .IP """ERA_T_FMT""" 4 |
| 459 |
.el .IP \f(CWERA_T_FMT\fR 4 |
| 460 |
.IX Item "ERA_T_FMT" |
| 461 |
.ie n .IP """ERA_D_T_FMT""" 4 |
| 462 |
.el .IP \f(CWERA_D_T_FMT\fR 4 |
| 463 |
.IX Item "ERA_D_T_FMT" |
| 464 |
.ie n .IP """T_FMT_AMPM""" 4 |
| 465 |
.el .IP \f(CWT_FMT_AMPM\fR 4 |
| 466 |
.IX Item "T_FMT_AMPM" |
| 467 |
.PD |
| 468 |
These are derived by using \f(CWstrftime()\fR, and not all versions of that function |
| 469 |
know about them. \f(CW""\fR is returned for these on such systems. |
| 470 |
.ie n .IP "All ""_NL_\fIfoo\fR"" items" 4 |
| 471 |
.el .IP "All \f(CW_NL_\fR\f(CIfoo\fR\f(CW\fR items" 4 |
| 472 |
.IX Item "All _NL_foo items" |
| 473 |
These return the same values as they do on boxes that don't have the |
| 474 |
appropriate underlying locale categories. |
| 475 |
.PP |
| 476 |
See your \fBnl_langinfo\fR\|(3) for more information about the available |
| 477 |
constants. (Often this means having to look directly at the |
| 478 |
\&\fIlanginfo.h\fR C header file.) |
| 479 |
.SS EXPORT |
| 480 |
.IX Subsection "EXPORT" |
| 481 |
By default only the \f(CWlanginfo()\fR function is exported. |
| 482 |
.SH BUGS |
| 483 |
.IX Header "BUGS" |
| 484 |
Before Perl 5.28, the returned values are unreliable for the \f(CW\*(C`RADIXCHAR\*(C'\fR and |
| 485 |
\&\f(CW\*(C`THOUSEP\*(C'\fR locale constants. |
| 486 |
.PP |
| 487 |
Starting in 5.28, changing locales on threaded builds is supported on systems |
| 488 |
that offer thread-safe locale functions. These include POSIX 2008 systems and |
| 489 |
Windows starting with Visual Studio 2005, and this module will work properly |
| 490 |
in such situations. However, on threaded builds on Windows prior to Visual |
| 491 |
Studio 2015, retrieving the items \f(CW\*(C`CRNCYSTR\*(C'\fR and \f(CW\*(C`THOUSEP\*(C'\fR can result in a |
| 492 |
race with a thread that has converted to use the global locale. It is quite |
| 493 |
uncommon for a thread to have done this. It would be possible to construct a |
| 494 |
workaround for this; patches welcome: see "switch_to_global_locale" in perlapi. |
| 495 |
.SH "SEE ALSO" |
| 496 |
.IX Header "SEE ALSO" |
| 497 |
perllocale, "localeconv" in POSIX, "setlocale" in POSIX, \fBnl_langinfo\fR\|(3). |
| 498 |
.SH AUTHOR |
| 499 |
.IX Header "AUTHOR" |
| 500 |
Jarkko Hietaniemi, <[email protected]>. Now maintained by Perl 5 porters. |
| 501 |
.SH "COPYRIGHT AND LICENSE" |
| 502 |
.IX Header "COPYRIGHT AND LICENSE" |
| 503 |
Copyright 2001 by Jarkko Hietaniemi |
| 504 |
.PP |
| 505 |
This library is free software; you can redistribute it and/or modify |
| 506 |
it under the same terms as Perl itself. |