1NL_LANGINFO(3) Linux Programmer's Manual NL_LANGINFO(3)
2
3
4
6 nl_langinfo, nl_langinfo_l - query language and locale information
7
9 #include <langinfo.h>
10
11 char *nl_langinfo(nl_item item);
12 char *nl_langinfo_l(nl_item item, locale_t locale);
13
14 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
15
16 nl_langinfo_l():
17 Since glibc 2.24:
18 _POSIX_C_SOURCE >= 200809L
19 Glibc 2.23 and earlier:
20 _POSIX_C_SOURCE >= 200112L
21
23 The nl_langinfo() and nl_langinfo_l() functions provide access to lo‐
24 cale information in a more flexible way than localeconv(3). nl_lang‐
25 info() returns a string which is the value corresponding to item in the
26 program's current global locale. nl_langinfo_l() returns a string
27 which is the value corresponding to item for the locale identified by
28 the locale object locale, which was previously created by newlocale(3).
29 Individual and additional elements of the locale categories can be
30 queried.
31
32 Examples for the locale elements that can be specified in item using
33 the constants defined in <langinfo.h> are:
34
35 CODESET (LC_CTYPE)
36 Return a string with the name of the character encoding used in
37 the selected locale, such as "UTF-8", "ISO-8859-1", or
38 "ANSI_X3.4-1968" (better known as US-ASCII). This is the same
39 string that you get with "locale charmap". For a list of char‐
40 acter encoding names, try "locale -m" (see locale(1)).
41
42 D_T_FMT (LC_TIME)
43 Return a string that can be used as a format string for strf‐
44 time(3) to represent time and date in a locale-specific way (%c
45 conversion specification).
46
47 D_FMT (LC_TIME)
48 Return a string that can be used as a format string for strf‐
49 time(3) to represent a date in a locale-specific way (%x conver‐
50 sion specification).
51
52 T_FMT (LC_TIME)
53 Return a string that can be used as a format string for strf‐
54 time(3) to represent a time in a locale-specific way (%X conver‐
55 sion specification).
56
57 AM_STR (LC_TIME)
58 Return a string that represents affix for ante meridiem (before
59 noon, "AM") time. (Used in %p strftime(3) conversion specifica‐
60 tion.)
61
62 PM_STR (LC_TIME)
63 Return a string that represents affix for post meridiem (before
64 midnight, "PM") time. (Used in %p strftime(3) conversion speci‐
65 fication.)
66
67 T_FMT_AMPM (LC_TIME)
68 Return a string that can be used as a format string for strf‐
69 time(3) to represent a time in a.m. or p.m. notation in a lo‐
70 cale-specific way (%r conversion specification).
71
72 ERA (LC_TIME)
73 Return era description, which contains information about how
74 years are counted and displayed for each era in a locale. Each
75 era description segment shall have the format:
76
77 direction:offset:start_date:end_date:era_name:era_format
78
79 according to the definitions below:
80
81 direction Either a "