nl_langinfo()

Updated: May 06, 2022

Get information about the language or cultural area defined in the current locale

Synopsis:

#include <time.h>

char *nl_langinfo( nl_item item );

Arguments:

item
The item that you want information about; one of the following:
Item Type Description
CODESET LC_CTYPE Codeset name
D_T_FMT LC_TIME String for formatting the date and time
D_FMT LC_TIME String for formatting the date
T_FMT LC_TIME String for formatting the time
T_FMT_AMPM LC_TIME a.m. or p.m. formatting string
AM_STR LC_TIME Ante meridiem affix
PM_STR LC_TIME Post meridiem affix
DAY_1 through DAY_7 LC_TIME Name of the first through seventh day of the week
ABDAY_1 through ABDAY_7 LC_TIME Abbreviated name of the first through seventh day of the week
MON_1 through MON_12 LC_TIME Name of the first through twelfth month of the year
ABMON_1 through ABMON_12 LC_TIME Abbreviated name of the first through twelfth month of the year
ERA LC_TIME Era description segments
ERA_D_FMT LC_TIME Era date format string
ERA_D_T_FMT LC_TIME Era date and time format string
ERA_T_FMT LC_TIME Era time format string
ALT_DIGITS LC_TIME Alternate symbols for digits
RADIXCHAR LC_NUMERIC Radix character
THOUSEP LC_NUMERIC Separator for thousands
YESEXPR LC_MESSAGES Affirmative response expression
NOEXPR LC_MESSAGES Negative response expression
CRNCYSTR LC_MONETARY Local currency symbol, preceded by - if the symbol should appear before the value, + if the symbol should appear after the value, or . if the symbol should replace the radix character. If the local currency symbol is the empty string, nl_langinfo() returns the empty string ( "" ).

For information about the types, see setlocale().

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The nl_langinfo() function returns a pointer to a static string containing information relevant to the particular language or cultural area defined in the current locale.

Note:
  • Don't modify the returned string. The value of the string might be invalidated by subsequent calls to this function.
  • We provide this function for POSIX compatibility, but it isn't adequate for internationalization. We ship the International Components for Unicode libraries (libicu*) that you can use instead. For more information about ICU, see http://site.icu-project.org/home.

Returns:

A pointer to the requested string, or an empty string if the item couldn't be found.

Classification:

POSIX

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread No