1NL_LANGINFO(3)             Linux Programmer's Manual            NL_LANGINFO(3)
2
3
4

NAME

6       nl_langinfo - query language and locale information
7

SYNOPSIS

9       #include <langinfo.h>
10
11       char *nl_langinfo(nl_item item);
12

DESCRIPTION

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

RETURN VALUE

80       If no locale has been selected by setlocale(3) for the appropriate cat‐
81       egory, nl_langinfo() returns a pointer to the corresponding  string  in
82       the "C" locale.
83
84       If item is not valid, a pointer to an empty string is returned.
85
86       This  pointer  may  point to static data that may be overwritten on the
87       next call to nl_langinfo() or setlocale(3).
88

CONFORMING TO

90       SUSv2, POSIX.1-2001.
91

EXAMPLE

93       The following program sets the character type locale according  to  the
94       environment and queries the terminal character set.
95
96       #include <langinfo.h>
97       #include <locale.h>
98       #include <stdio.h>
99       #include <stdlib.h>
100
101       int
102       main(int argc, char *argv[])
103       {
104           setlocale(LC_CTYPE,"");
105           printf("%s\n",nl_langinfo(CODESET));
106           exit(EXIT_SUCCESS);
107       }
108

SEE ALSO

110       locale(1), localeconv(3), setlocale(3), charsets(7), locale(7)
111       The GNU C Library Reference Manual
112

COLOPHON

114       This  page  is  part of release 3.53 of the Linux man-pages project.  A
115       description of the project, and information about reporting  bugs,  can
116       be found at http://www.kernel.org/doc/man-pages/.
117
118
119
120GNU                               2010-10-03                    NL_LANGINFO(3)
Impressum