xref: /freebsd/lib/libc/locale/nl_langinfo.3 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
174f2b975SAlexey Zelkin.\" Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org>
21496a706SAlexey Zelkin.\" All rights reserved.
31496a706SAlexey Zelkin.\"
41496a706SAlexey Zelkin.\" Redistribution and use in source and binary forms, with or without
51496a706SAlexey Zelkin.\" modification, are permitted provided that the following conditions
61496a706SAlexey Zelkin.\" are met:
71496a706SAlexey Zelkin.\" 1. Redistributions of source code must retain the above copyright
81496a706SAlexey Zelkin.\"    notice, this list of conditions and the following disclaimer.
91496a706SAlexey Zelkin.\" 2. Redistributions in binary form must reproduce the above copyright
101496a706SAlexey Zelkin.\"    notice, this list of conditions and the following disclaimer in the
111496a706SAlexey Zelkin.\"    documentation and/or other materials provided with the distribution.
121496a706SAlexey Zelkin.\"
131496a706SAlexey Zelkin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
141496a706SAlexey Zelkin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
151496a706SAlexey Zelkin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
161496a706SAlexey Zelkin.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
171496a706SAlexey Zelkin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
181496a706SAlexey Zelkin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
191496a706SAlexey Zelkin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
201496a706SAlexey Zelkin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
211496a706SAlexey Zelkin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
221496a706SAlexey Zelkin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
231496a706SAlexey Zelkin.\" SUCH DAMAGE.
241496a706SAlexey Zelkin.\"
25*3cd6e239SYuri Pankov.Dd December 14, 2020
261496a706SAlexey Zelkin.Dt NL_LANGINFO 3
271496a706SAlexey Zelkin.Os
281496a706SAlexey Zelkin.Sh NAME
291496a706SAlexey Zelkin.Nm nl_langinfo
301496a706SAlexey Zelkin.Nd language information
311496a706SAlexey Zelkin.Sh LIBRARY
321496a706SAlexey Zelkin.Lb libc
331496a706SAlexey Zelkin.Sh SYNOPSIS
341496a706SAlexey Zelkin.In langinfo.h
351496a706SAlexey Zelkin.Ft char *
361496a706SAlexey Zelkin.Fn nl_langinfo "nl_item item"
37ea915419SIsabell Long.Ft char *
38ea915419SIsabell Long.Fn nl_langinfo_l "nl_item item" "locale_t loc"
391496a706SAlexey Zelkin.Sh DESCRIPTION
401496a706SAlexey ZelkinThe
411496a706SAlexey Zelkin.Fn nl_langinfo
421496a706SAlexey Zelkinfunction returns a pointer to a string containing information relevant to
43ea915419SIsabell Longthe particular language or cultural area defined in the program or thread's
44ea915419SIsabell Longlocale, or in the case of
45ea915419SIsabell Long.Fn nl_langinfo_l ,
46ea915419SIsabell Longthe locale passed as the second argument.
471496a706SAlexey Zelkin.Pp
481496a706SAlexey ZelkinCalls to
491496a706SAlexey Zelkin.Fn setlocale
501496a706SAlexey Zelkinwith a category corresponding to the category of
511496a706SAlexey Zelkin.Fa item ,
521496a706SAlexey Zelkinor to the
531496a706SAlexey Zelkincategory
541496a706SAlexey Zelkin.Dv LC_ALL ,
5511ea9440SChristian Brueffermay overwrite the buffer pointed to by the return value.
56*3cd6e239SYuri Pankov.Pp
57*3cd6e239SYuri PankovThe manifest constant names and values of
58*3cd6e239SYuri Pankov.Fa item
59*3cd6e239SYuri Pankovare defined in
60*3cd6e239SYuri Pankov.In langinfo.h .
61*3cd6e239SYuri Pankov.Pp
62*3cd6e239SYuri PankovThe following standard constants are recognized:
63*3cd6e239SYuri Pankov.Bl -column "Constant" "Category"
64*3cd6e239SYuri Pankov.It Sy Constant Ta Sy Category Ta Sy Description
65*3cd6e239SYuri Pankov.It Dv CODESET Ta Dv LC_CTYPE Ta codeset name
66*3cd6e239SYuri Pankov.It Dv D_T_FMT Ta Dv LC_TIME Ta string for formatting date and time
67*3cd6e239SYuri Pankov.It Dv D_FMT Ta Dv LC_TIME Ta date format string
68*3cd6e239SYuri Pankov.It Dv T_FMT Ta Dv LC_TIME Ta time format string
69*3cd6e239SYuri Pankov.It Dv T_FMT_AMPM Ta Dv LC_TIME Ta a.m. or p.m. time format string
70*3cd6e239SYuri Pankov.It Dv AM_STR Ta Dv LC_TIME Ta ante-meridiem affix
71*3cd6e239SYuri Pankov.It Dv PM_STR Ta Dv LC_TIME Ta post-meridiem affix
72*3cd6e239SYuri Pankov.It Dv DAY_1 Ta Dv LC_TIME Ta name of the first day of the week
73*3cd6e239SYuri Pankov.It Dv DAY_2 Ta Dv LC_TIME Ta name of the second day of the week
74*3cd6e239SYuri Pankov.It Dv DAY_3 Ta Dv LC_TIME Ta name of the third day of the week
75*3cd6e239SYuri Pankov.It Dv DAY_4 Ta Dv LC_TIME Ta name of the fourth day of the week
76*3cd6e239SYuri Pankov.It Dv DAY_5 Ta Dv LC_TIME Ta name of the fifth day of the week
77*3cd6e239SYuri Pankov.It Dv DAY_6 Ta Dv LC_TIME Ta name of the sixth day of the week
78*3cd6e239SYuri Pankov.It Dv DAY_7 Ta Dv LC_TIME Ta name of the seventh day of the week
79*3cd6e239SYuri Pankov.It Dv ABDAY_1 Ta Dv LC_TIME Ta abbreviated name of the first day of the week
80*3cd6e239SYuri Pankov.It Dv ABDAY_2 Ta Dv LC_TIME Ta abbreviated name of the second day of the week
81*3cd6e239SYuri Pankov.It Dv ABDAY_3 Ta Dv LC_TIME Ta abbreviated name of the third day of the week
82*3cd6e239SYuri Pankov.It Dv ABDAY_4 Ta Dv LC_TIME Ta abbreviated name of the fourth day of the week
83*3cd6e239SYuri Pankov.It Dv ABDAY_5 Ta Dv LC_TIME Ta abbreviated name of the fifth day of the week
84*3cd6e239SYuri Pankov.It Dv ABDAY_6 Ta Dv LC_TIME Ta abbreviated name of the sixth day of the week
85*3cd6e239SYuri Pankov.It Dv ABDAY_7 Ta Dv LC_TIME Ta abbreviated name of the seventh day of the week
86*3cd6e239SYuri Pankov.It Dv MON_1 Ta Dv LC_TIME Ta name of the first month of the year
87*3cd6e239SYuri Pankov.It Dv MON_2 Ta Dv LC_TIME Ta name of the second month
88*3cd6e239SYuri Pankov.It Dv MON_3 Ta Dv LC_TIME Ta name of the third month
89*3cd6e239SYuri Pankov.It Dv MON_4 Ta Dv LC_TIME Ta name of the fourth month
90*3cd6e239SYuri Pankov.It Dv MON_5 Ta Dv LC_TIME Ta name of the fifth month
91*3cd6e239SYuri Pankov.It Dv MON_6 Ta Dv LC_TIME Ta name of the sixth month
92*3cd6e239SYuri Pankov.It Dv MON_7 Ta Dv LC_TIME Ta name of the seventh month
93*3cd6e239SYuri Pankov.It Dv MON_8 Ta Dv LC_TIME Ta name of the eighth month
94*3cd6e239SYuri Pankov.It Dv MON_9 Ta Dv LC_TIME Ta name of the ninth month
95*3cd6e239SYuri Pankov.It Dv MON_10 Ta Dv LC_TIME Ta name of the tenth month
96*3cd6e239SYuri Pankov.It Dv MON_11 Ta Dv LC_TIME Ta name of the eleventh month
97*3cd6e239SYuri Pankov.It Dv MON_12 Ta Dv LC_TIME Ta name of the twelfth month
98*3cd6e239SYuri Pankov.It Dv ABMON_1 Ta Dv LC_TIME Ta abbreviated name of the first month
99*3cd6e239SYuri Pankov.It Dv ABMON_2 Ta Dv LC_TIME Ta abbreviated name of the second month
100*3cd6e239SYuri Pankov.It Dv ABMON_3 Ta Dv LC_TIME Ta abbreviated name of the third month
101*3cd6e239SYuri Pankov.It Dv ABMON_4 Ta Dv LC_TIME Ta abbreviated name of the fourth month
102*3cd6e239SYuri Pankov.It Dv ABMON_5 Ta Dv LC_TIME Ta abbreviated name of the fifth month
103*3cd6e239SYuri Pankov.It Dv ABMON_6 Ta Dv LC_TIME Ta abbreviated name of the sixth month
104*3cd6e239SYuri Pankov.It Dv ABMON_7 Ta Dv LC_TIME Ta abbreviated name of the seventh month
105*3cd6e239SYuri Pankov.It Dv ABMON_8 Ta Dv LC_TIME Ta abbreviated name of the eighth month
106*3cd6e239SYuri Pankov.It Dv ABMON_9 Ta Dv LC_TIME Ta abbreviated name of the ninth month
107*3cd6e239SYuri Pankov.It Dv ABMON_10 Ta Dv LC_TIME Ta abbreviated name of the tenth month
108*3cd6e239SYuri Pankov.It Dv ABMON_11 Ta Dv LC_TIME Ta abbreviated name of the eleventh month
109*3cd6e239SYuri Pankov.It Dv ABMON_12 Ta Dv LC_TIME Ta abbreviated name of the twelfth month
110*3cd6e239SYuri Pankov.It Dv ERA Ta Dv LC_TIME Ta era description segments
111*3cd6e239SYuri Pankov.It Dv ERA_D_FMT Ta Dv LC_TIME Ta era date format string
112*3cd6e239SYuri Pankov.It Dv ERA_D_T_FMT Ta Dv LC_TIME Ta era date and time format string
113*3cd6e239SYuri Pankov.It Dv ERA_T_FMT Ta Dv LC_TIME Ta era time format string
114*3cd6e239SYuri Pankov.It Dv ALT_DIGITS Ta Dv LC_TIME Ta alternative symbols for digits
115*3cd6e239SYuri Pankov.It Dv RADIXCHAR Ta Dv LC_NUMERIC Ta radix character
116*3cd6e239SYuri Pankov.It Dv THOUSEP Ta Dv LC_NUMERIC Ta separator for thousands
117*3cd6e239SYuri Pankov.It Dv YESEXPR Ta Dv LC_MESSAGES Ta affirmative response extended regular
118*3cd6e239SYuri Pankovexpression
119*3cd6e239SYuri Pankov.It Dv NOEXPR Ta Dv LC_MESSAGES Ta negative response extended regular expression
120*3cd6e239SYuri Pankov.It Dv CRNCYSTR Ta Dv LC_MONETARY Ta local currency symbol, preceded by '-' if the
121*3cd6e239SYuri Pankovsymbol should appear before the value, '+' if the symbol should appear after the
122*3cd6e239SYuri Pankovvalue, or '.' if the symbol should replace the radix character; if the local
123*3cd6e239SYuri Pankovcurrency symbol is the empty string, implementations may return the empty string
124*3cd6e239SYuri Pankov.Pq Qq
125*3cd6e239SYuri Pankov.El
126*3cd6e239SYuri Pankov.Pp
127*3cd6e239SYuri PankovThe following non-standard
128*3cd6e239SYuri Pankov.Fx
129*3cd6e239SYuri Pankovextensions are recognized:
130*3cd6e239SYuri Pankov.Bl -column "Constant" "Category"
131*3cd6e239SYuri Pankov.It Sy Constant Ta Sy Category Ta Sy Description
132*3cd6e239SYuri Pankov.It Dv D_MD_ORDER Ta Dv LC_TIME Ta month/day order
133*3cd6e239SYuri Pankov.It Dv ALTMON_1 Ta Dv LC_TIME Ta standalone name of the first month
134*3cd6e239SYuri Pankov.It Dv ALTMON_2 Ta Dv LC_TIME Ta standalone name of the second month
135*3cd6e239SYuri Pankov.It Dv ALTMON_3 Ta Dv LC_TIME Ta standalone name of the third month
136*3cd6e239SYuri Pankov.It Dv ALTMON_4 Ta Dv LC_TIME Ta standalone name of the fourth month
137*3cd6e239SYuri Pankov.It Dv ALTMON_5 Ta Dv LC_TIME Ta standalone name of the fifth month
138*3cd6e239SYuri Pankov.It Dv ALTMON_6 Ta Dv LC_TIME Ta standalone name of the sixth month
139*3cd6e239SYuri Pankov.It Dv ALTMON_7 Ta Dv LC_TIME Ta standalone name of the seventh month
140*3cd6e239SYuri Pankov.It Dv ALTMON_8 Ta Dv LC_TIME Ta standalone name of the eighth month
141*3cd6e239SYuri Pankov.It Dv ALTMON_9 Ta Dv LC_TIME Ta standalone name of the ninth month
142*3cd6e239SYuri Pankov.It Dv ALTMON_10 Ta Dv LC_TIME Ta standalone name of the tenth month
143*3cd6e239SYuri Pankov.It Dv ALTMON_11 Ta Dv LC_TIME Ta standalone name of the eleventh month
144*3cd6e239SYuri Pankov.It Dv ALTMON_12 Ta Dv LC_TIME Ta standalone name of the twelfth month
145*3cd6e239SYuri Pankov.It Dv YESSTR Ta Dv LC_MESSAGES Ta affirmative response string
146*3cd6e239SYuri Pankov.It Dv NOSTR Ta Dv LC_MESSAGES Ta negative response string
147*3cd6e239SYuri Pankov.El
1481496a706SAlexey Zelkin.Sh RETURN VALUES
1491496a706SAlexey ZelkinIn a locale where langinfo data is not defined,
1501496a706SAlexey Zelkin.Fn nl_langinfo
151*3cd6e239SYuri Pankovreturns a pointer to the corresponding string in the POSIX locale.
152ea915419SIsabell Long.Fn nl_langinfo_l
153ea915419SIsabell Longreturns the same values as
154ea915419SIsabell Long.Fn nl_langinfo .
1551496a706SAlexey ZelkinIn all locales,
1561496a706SAlexey Zelkin.Fn nl_langinfo
1571496a706SAlexey Zelkinreturns a pointer to an empty string if
1581496a706SAlexey Zelkin.Fa item
1591496a706SAlexey Zelkincontains an invalid setting.
16024a0682cSRuslan Ermilov.Sh EXAMPLES
16124a0682cSRuslan ErmilovFor example:
16224a0682cSRuslan Ermilov.Pp
16324a0682cSRuslan Ermilov.Dl nl_langinfo(ABDAY_1)
16424a0682cSRuslan Ermilov.Pp
16524a0682cSRuslan Ermilovwould return a pointer to the string
16624a0682cSRuslan Ermilov.Qq Li Dom
16724a0682cSRuslan Ermilovif the identified language was
16824a0682cSRuslan ErmilovPortuguese, and
16924a0682cSRuslan Ermilov.Qq Li Sun
17024a0682cSRuslan Ermilovif the identified language was English.
1711496a706SAlexey Zelkin.Sh SEE ALSO
1721496a706SAlexey Zelkin.Xr setlocale 3
1731496a706SAlexey Zelkin.Sh STANDARDS
1741496a706SAlexey ZelkinThe
1751496a706SAlexey Zelkin.Fn nl_langinfo
1761496a706SAlexey Zelkinfunction conforms to
1771496a706SAlexey Zelkin.St -susv2 .
178ea915419SIsabell LongThe
179ea915419SIsabell Long.Fn nl_langinfo_l
180ea915419SIsabell Longfunction conforms to
181ea915419SIsabell Long.St -p1003.1-2008 .
1821496a706SAlexey Zelkin.Sh HISTORY
1831496a706SAlexey ZelkinThe
1841496a706SAlexey Zelkin.Fn nl_langinfo
1851496a706SAlexey Zelkinfunction first appeared in
18662538f5aSDima Dorfman.Fx 4.6 .
187