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
22 CODESET (LC_CTYPE)
23 Return a string with the name of the character encoding used in
24 the selected locale, such as "UTF-8", "ISO-8859-1", or
25 "ANSI_X3.4-1968" (better known as US-ASCII). This is the same
26 string that you get with "locale charmap". For a list of charac‐
27 ter encoding names, try "locale -m", cf. locale(1).
28
29
30 D_T_FMT (LC_TIME)
31 Return a string that can be used as a format string for strf‐
32 time(3) to represent time and date in a locale-specific way.
33
34
35 D_FMT (LC_TIME)
36 Return a string that can be used as a format string for strf‐
37 time(3) to represent a date in a locale-specific way.
38
39
40 T_FMT (LC_TIME)
41 Return a string that can be used as a format string for strf‐
42 time(3) to represent a time in a locale-specific way.
43
44
45 DAY_{1–7} (LC_TIME)
46 Return name of the n-th day of the week. [Warning: this follows
47 the US convention DAY_1 = Sunday, not the international conven‐
48 tion (ISO 8601) that Monday is the first day of the week.]
49
50
51 ABDAY_{1–7} (LC_TIME)
52 Return abbreviated name of the n-th day of the week.
53
54
55 MON_{1–12} (LC_TIME)
56 Return name of the n-th month.
57
58
59 ABMON_{1–12} (LC_TIME)
60 Return abbreviated name of the n-th month.
61
62
63 RADIXCHAR (LC_NUMERIC)
64 Return radix character (decimal dot, decimal comma, etc.).
65
66
67 THOUSEP (LC_NUMERIC)
68 Return separator character for thousands (groups of three dig‐
69 its).
70
71
72 YESEXPR (LC_MESSAGES)
73 Return a regular expression that can be used with the regex(3)
74 function to recognize a positive response to a yes/no question.
75
76
77 NOEXPR (LC_MESSAGES)
78 Return a regular expression that can be used with the regex(3)
79 function to recognize a negative response to a yes/no question.
80
81
82 CRNCYSTR (LC_MONETARY)
83 Return the currency symbol, preceded by "-" if the symbol should
84 appear before the value, "+" if the symbol should appear after
85 the value, or "." if the symbol should replace the radix charac‐
86 ter.
87
88 The above list covers just some examples of items that can be
89 requested. For a more detailed list, consult The GNU C Library Refer‐
90 ence Manual.
91
93 If no locale has been selected for the appropriate category, nl_lang‐
94 info() returns a pointer to the corresponding string in the "C" locale.
95
96 If item is not valid, a pointer to an empty string is returned.
97
98 This pointer may point to static data that may be overwritten on the
99 next call to nl_langinfo() or setlocale().
100
102 SUSv2, POSIX.1-2001.
103
105 locale(1), localeconv(3), setlocale(3), charsets(7), locale(7) The GNU
106 C Library Reference Manual
107
108
109
110GNU 2001-05-11 NL_LANGINFO(3)