1 .\" $NetBSD: src/lib/libc/locale/nl_langinfo.3,v 1.13 2004/01/24 16:58:54 wiz Exp $
2 .\" $DragonFly: src/lib/libc/locale/nl_langinfo.3,v 1.5 2006/05/26 19:39:37 swildner Exp $
4 .\" Written by J.T. Conklin <jtc@NetBSD.org>.
12 .Nd get locale information
18 .Fn nl_langinfo "nl_item item"
22 function returns a pointer to a string containing information
23 set by the program's locale.
25 The names and values of
29 The entries under Category indicate in which
31 category each item is defined.
34 .ta \w'ERA_D_T_FMT'u+1n +\w'LC_MESSAGES'u+1n +\w'Name of the third day of the week (e.g.: Tuesday)'u
35 \fIConstant\fP \fICategory\fP \fIMeaning\fP
36 .ta \w'ERA_D_T_FMT'u+1n +\w'LC_MESSAGES'u+1n +\w'Name of the third day of the week (e.g.: Tuesday)'u+1nC
38 CODESET LC_CTYPE Codeset name
39 D_T_FMT LC_TIME String for formatting date and time
40 D_FMT LC_TIME Date format string
41 T_FMT LC_TIME Time format string
42 T_FMT_AMPM LC_TIME A.M. or P.M. time format string
43 AM_STR LC_TIME Ante-meridiem affix
44 PM_STR LC_TIME Post-meridiem affix
45 DAY_1 LC_TIME Name of the first day of the week (e.g.: Sunday)
46 DAY_2 LC_TIME Name of the second day of the week (e.g.: Monday)
47 DAY_3 LC_TIME Name of the third day of the week (e.g.: Tuesday)
48 DAY_4 LC_TIME Name of the fourth day of the week (e.g.: Wednesday)
49 DAY_5 LC_TIME Name of the fifth day of the week (e.g.: Thursday)
50 DAY_6 LC_TIME Name of the sixth day of the week (e.g.: Friday)
51 DAY_7 LC_TIME Name of the seventh day of the week (e.g.: Saturday)
52 ABDAY_1 LC_TIME Abbreviated name of the first day of the week
53 ABDAY_2 LC_TIME Abbreviated name of the second day of the week
54 ABDAY_3 LC_TIME Abbreviated name of the third day of the week
55 ABDAY_4 LC_TIME Abbreviated name of the fourth day of the week
56 ABDAY_5 LC_TIME Abbreviated name of the fifth day of the week
57 ABDAY_6 LC_TIME Abbreviated name of the sixth day of the week
58 ABDAY_7 LC_TIME Abbreviated name of the seventh day of the week
59 MON_1 LC_TIME Name of the first month of the year
60 MON_2 LC_TIME Name of the second month
61 MON_3 LC_TIME Name of the third month
62 MON_4 LC_TIME Name of the fourth month
63 MON_5 LC_TIME Name of the fifth month
64 MON_6 LC_TIME Name of the sixth month
65 MON_7 LC_TIME Name of the seventh month
66 MON_8 LC_TIME Name of the eighth month
67 MON_9 LC_TIME Name of the ninth month
68 MON_10 LC_TIME Name of the tenth month
69 MON_11 LC_TIME Name of the eleventh month
70 MON_12 LC_TIME Name of the twelfth month
71 ABMON_1 LC_TIME Abbreviated name of the first month
72 ABMON_2 LC_TIME Abbreviated name of the second month
73 ABMON_3 LC_TIME Abbreviated name of the third month
74 ABMON_4 LC_TIME Abbreviated name of the fourth month
75 ABMON_5 LC_TIME Abbreviated name of the fifth month
76 ABMON_6 LC_TIME Abbreviated name of the sixth month
77 ABMON_7 LC_TIME Abbreviated name of the seventh month
78 ABMON_8 LC_TIME Abbreviated name of the eighth month
79 ABMON_9 LC_TIME Abbreviated name of the ninth month
80 ABMON_10 LC_TIME Abbreviated name of the tenth month
81 ABMON_11 LC_TIME Abbreviated name of the eleventh month
82 ABMON_12 LC_TIME Abbreviated name of the twelfth month
83 ERA LC_TIME Era description segments
84 ERA_D_FMT LC_TIME Era date format string
85 ERA_D_T_FMT LC_TIME Era date and time format string
86 ERA_T_FMT LC_TIME Era time format string
87 ALT_DIGITS LC_TIME Alternative symbols for digits
88 RADIXCHAR LC_NUMERIC Radix character
89 THOUSEP LC_NUMERIC Separator for thousands
90 YESEXPR LC_MESSAGES Affirmative response expression
91 NOEXPR LC_MESSAGES Negative response expression
92 .\" CRNCYSTR LC_MONETARY Local currency symbol
96 returns a pointer to an empty string if
100 The following example uses
102 to obtain the date and time format for the current locale:
104 .Bd -literal -offset indent
106 #include <langinfo.h>
111 char datestring[100];
118 (void)setlocale(LC_ALL, "");
119 ptr = nl_langinfo(D_T_FMT);
120 strftime(datestring, sizeof(datestring), ptr, tm);
121 printf("%s\en",datestring);
126 .\" The following example uses
128 .\" to obtain the setting of the currency symbol for the current locale:
131 .\" #include <langinfo.h>
132 .\" #include <locale.h>
136 .\" (void)setlocale(LC_ALL, "");
137 .\" ptr = nl_langinfo(CRNCYSTR);
138 .\" printf("%s", ptr);