1 .\" Copyright (c) 2001 Markus Kuhn <mkuhn@acm.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
10 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
12 .\" Corrected prototype, 2002-10-18, aeb
14 .TH NL_LANGINFO 3 2010-10-03 "GNU" "Linux Programmer's Manual"
16 nl_langinfo \- query language and locale information
19 .B #include <langinfo.h>
21 .BI "char *nl_langinfo(nl_item " item );
26 function provides access to locale information
27 in a more flexible way than
30 Individual and additional elements of the locale categories can
33 Examples for the locale elements that can be specified in \fIitem\fP
34 using the constants defined in \fI<langinfo.h>\fP are:
36 .BR CODESET \ (LC_CTYPE)
37 Return a string with the name of the character encoding used in the
38 selected locale, such as "UTF-8", "ISO-8859-1", or "ANSI_X3.4-1968"
39 (better known as US-ASCII).
40 This is the same string that you get with
42 For a list of character encoding names,
43 try "locale \-m", cf.\&
46 .BR D_T_FMT \ (LC_TIME)
47 Return a string that can be used as a format string for
49 to represent time and date in a locale-specific way.
52 Return a string that can be used as a format string for
54 to represent a date in a locale-specific way.
57 Return a string that can be used as a format string for
59 to represent a time in a locale-specific way.
61 .BR DAY_ "{1\(en7} (LC_TIME)"
62 Return name of the \fIn\fP-th day of the week. [Warning: this follows
63 the US convention DAY_1 = Sunday, not the international convention
64 (ISO 8601) that Monday is the first day of the week.]
66 .BR ABDAY_ "{1\(en7} (LC_TIME)"
67 Return abbreviated name of the \fIn\fP-th day of the week.
69 .BR MON_ "{1\(en12} (LC_TIME)"
70 Return name of the \fIn\fP-th month.
72 .BR ABMON_ "{1\(en12} (LC_TIME)"
73 Return abbreviated name of the \fIn\fP-th month.
75 .BR RADIXCHAR \ (LC_NUMERIC)
76 Return radix character (decimal dot, decimal comma, etc.).
78 .BR THOUSEP \ (LC_NUMERIC)
79 Return separator character for thousands (groups of three digits).
81 .BR YESEXPR \ (LC_MESSAGES)
82 Return a regular expression that can be used with the
84 function to recognize a positive response to a yes/no question.
86 .BR NOEXPR \ (LC_MESSAGES)
87 Return a regular expression that can be used with the
89 function to recognize a negative response to a yes/no question.
91 .BR CRNCYSTR \ (LC_MONETARY)
92 Return the currency symbol, preceded by "\-" if the symbol should
93 appear before the value, "+" if the symbol should appear after the
94 value, or "." if the symbol should replace the radix character.
96 The above list covers just some examples of items that can be requested.
97 For a more detailed list, consult
98 .IR "The GNU C Library Reference Manual" .
100 If no locale has been selected by
102 for the appropriate category,
104 returns a pointer to the corresponding string in the
107 If \fIitem\fP is not valid, a pointer to an empty string is returned.
109 This pointer may point to static data that may be overwritten on the
117 The following program sets the character type locale according to the
118 environment and queries the terminal character set.
121 #include <langinfo.h>
127 main(int argc, char *argv[])
129 setlocale(LC_CTYPE,"");
130 printf("%s\\n",nl_langinfo(CODESET));
141 The GNU C Library Reference Manual