1NL_LANGINFO(3) Linux Programmer's Manual NL_LANGINFO(3)
2
3
4
6 nl_langinfo - query language and locale information
7
9 #include <langinfo.h>
10
11 char *nl_langinfo(nl_item item);
12
14 The nl_langinfo() function provides access to locale information in a
15 more flexible way than localeconv(3) does. Individual and additional
16 elements of the locale categories can be queried.
17
18 Examples for the locale elements that can be specified in item using
19 the constants defined in <langinfo.h> are:
20
21 CODESET (LC_CTYPE)
22 Return a string with the name of the character encoding used in
23 the selected locale, such as "UTF-8", "ISO-8859-1", or
24 "ANSI_X3.4-1968" (better known as US-ASCII). This is the same
25 string that you get with "locale charmap". For a list of char‐
26 acter encoding names, try "locale -m", cf. locale(1).
27
28 D_T_FMT (LC_TIME)
29 Return a string that can be used as a format string for strf‐
30 time(3) to represent time and date in a locale-specific way.
31
32 D_FMT (LC_TIME)
33 Return a string that can be used as a format string for strf‐
34 time(3) to represent a date in a locale-specific way.
35
36 T_FMT (LC_TIME)
37 Return a string that can be used as a format string for strf‐
38 time(3) to represent a time in a locale-specific way.
39
40 DAY_{1–7} (LC_TIME)
41 Return name of the n-th day of the week. [Warning: this follows
42 the US convention DAY_1 = Sunday, not the international conven‐
43 tion (ISO 8601) that Monday is the first day of the week.]
44
45 ABDAY_{1–7} (LC_TIME)
46 Return abbreviated name of the n-th day of the week.
47
48 MON_{1–12} (LC_TIME)
49 Return name of the n-th month.
50
51 ABMON_{1–12} (LC_TIME)
52 Return abbreviated name of the n-th month.
53
54 RADIXCHAR (LC_NUMERIC)
55 Return radix character (decimal dot, decimal comma, etc.).
56
57 THOUSEP (LC_NUMERIC)
58 Return separator character for thousands (groups of three dig‐
59 its).
60
61 YESEXPR (LC_MESSAGES)
62 Return a regular expression that can be used with the regex(3)
63 function to recognize a positive response to a yes/no question.
64
65 NOEXPR (LC_MESSAGES)
66 Return a regular expression that can be used with the regex(3)
67 function to recognize a negative response to a yes/no question.
68
69 CRNCYSTR (LC_MONETARY)
70 Return the currency symbol, preceded by "-" if the symbol should
71 appear before the value, "+" if the symbol should appear after
72 the value, or "." if the symbol should replace the radix charac‐
73 ter.
74
75 The above list covers just some examples of items that can be
76 requested. For a more detailed list, consult The GNU C Library Refer‐
77 ence Manual.
78
80 If no locale has been selected for the appropriate category, nl_lang‐
81 info() returns a pointer to the corresponding string in the "C" locale.
82
83 If item is not valid, a pointer to an empty string is returned.
84
85 This pointer may point to static data that may be overwritten on the
86 next call to nl_langinfo() or setlocale(3).
87
89 SUSv2, POSIX.1-2001.
90
92 locale(1), localeconv(3), setlocale(3), charsets(7), locale(7)
93 The GNU C Library Reference Manual
94
96 This page is part of release 3.25 of the Linux man-pages project. A
97 description of the project, and information about reporting bugs, can
98 be found at http://www.kernel.org/doc/man-pages/.
99
100
101
102GNU 2001-05-11 NL_LANGINFO(3)