---
name: "nl_langinfo"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/nl_langinfo"
---

# nl\_langinfo(3)

language information

## NAME

**nl\_langinfo** – language information

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<langinfo.h\>**

*char* *\**\

**nl\_langinfo**(*nl\_item item*);

*char* *\**\

**nl\_langinfo\_l**(*nl\_item item*, *locale\_t loc*);

## DESCRIPTION

The **nl\_langinfo**() function returns a pointer to a string containing information relevant to the particular language or cultural area defined in the program or thread's locale, or in the case of **nl\_langinfo\_l**(), the locale passed as the second argument.

Calls to **setlocale**() with a category corresponding to the category of *item*, or to the category LC\_ALL, may overwrite the buffer pointed to by the return value.

The manifest constant names and values of *item* are defined in ⟨langinfo.h⟩.

The following standard constants are recognized:

| | | |
| --- | --- | --- |
| **Constant** | **Category** | **Description** |
| CODESET | LC\_CTYPE | codeset name |
| D\_T\_FMT | LC\_TIME | string for formatting date and time |
| D\_FMT | LC\_TIME | date format string |
| T\_FMT | LC\_TIME | time format string |
| T\_FMT\_AMPM | LC\_TIME | a.m. or p.m. time format string |
| AM\_STR | LC\_TIME | ante-meridiem affix |
| PM\_STR | LC\_TIME | post-meridiem affix |
| DAY\_1 | LC\_TIME | name of the first day of the week |
| DAY\_2 | LC\_TIME | name of the second day of the week |
| DAY\_3 | LC\_TIME | name of the third day of the week |
| DAY\_4 | LC\_TIME | name of the fourth day of the week |
| DAY\_5 | LC\_TIME | name of the fifth day of the week |
| DAY\_6 | LC\_TIME | name of the sixth day of the week |
| DAY\_7 | LC\_TIME | name of the seventh day of the week |
| ABDAY\_1 | LC\_TIME | abbreviated name of the first day of the week |
| ABDAY\_2 | LC\_TIME | abbreviated name of the second day of the week |
| ABDAY\_3 | LC\_TIME | abbreviated name of the third day of the week |
| ABDAY\_4 | LC\_TIME | abbreviated name of the fourth day of the week |
| ABDAY\_5 | LC\_TIME | abbreviated name of the fifth day of the week |
| ABDAY\_6 | LC\_TIME | abbreviated name of the sixth day of the week |
| ABDAY\_7 | LC\_TIME | abbreviated name of the seventh day of the week |
| MON\_1 | LC\_TIME | name of the first month of the year |
| MON\_2 | LC\_TIME | name of the second month |
| MON\_3 | LC\_TIME | name of the third month |
| MON\_4 | LC\_TIME | name of the fourth month |
| MON\_5 | LC\_TIME | name of the fifth month |
| MON\_6 | LC\_TIME | name of the sixth month |
| MON\_7 | LC\_TIME | name of the seventh month |
| MON\_8 | LC\_TIME | name of the eighth month |
| MON\_9 | LC\_TIME | name of the ninth month |
| MON\_10 | LC\_TIME | name of the tenth month |
| MON\_11 | LC\_TIME | name of the eleventh month |
| MON\_12 | LC\_TIME | name of the twelfth month |
| ABMON\_1 | LC\_TIME | abbreviated name of the first month |
| ABMON\_2 | LC\_TIME | abbreviated name of the second month |
| ABMON\_3 | LC\_TIME | abbreviated name of the third month |
| ABMON\_4 | LC\_TIME | abbreviated name of the fourth month |
| ABMON\_5 | LC\_TIME | abbreviated name of the fifth month |
| ABMON\_6 | LC\_TIME | abbreviated name of the sixth month |
| ABMON\_7 | LC\_TIME | abbreviated name of the seventh month |
| ABMON\_8 | LC\_TIME | abbreviated name of the eighth month |
| ABMON\_9 | LC\_TIME | abbreviated name of the ninth month |
| ABMON\_10 | LC\_TIME | abbreviated name of the tenth month |
| ABMON\_11 | LC\_TIME | abbreviated name of the eleventh month |
| ABMON\_12 | LC\_TIME | abbreviated name of the twelfth month |
| 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 | alternative symbols for digits |
| RADIXCHAR | LC\_NUMERIC | radix character |
| THOUSEP | LC\_NUMERIC | separator for thousands |
| YESEXPR | LC\_MESSAGES | affirmative response extended regular |
| NOEXPR | LC\_MESSAGES | negative response extended regular expression |
| CRNCYSTR | LC\_MONETARY | local currency symbol, preceded by '-' if the |

The following non-standard FreeBSD extensions are recognized:

| | | |
| --- | --- | --- |
| **Constant** | **Category** | **Description** |
| D\_MD\_ORDER | LC\_TIME | month/day order |
| ALTMON\_1 | LC\_TIME | standalone name of the first month |
| ALTMON\_2 | LC\_TIME | standalone name of the second month |
| ALTMON\_3 | LC\_TIME | standalone name of the third month |
| ALTMON\_4 | LC\_TIME | standalone name of the fourth month |
| ALTMON\_5 | LC\_TIME | standalone name of the fifth month |
| ALTMON\_6 | LC\_TIME | standalone name of the sixth month |
| ALTMON\_7 | LC\_TIME | standalone name of the seventh month |
| ALTMON\_8 | LC\_TIME | standalone name of the eighth month |
| ALTMON\_9 | LC\_TIME | standalone name of the ninth month |
| ALTMON\_10 | LC\_TIME | standalone name of the tenth month |
| ALTMON\_11 | LC\_TIME | standalone name of the eleventh month |
| ALTMON\_12 | LC\_TIME | standalone name of the twelfth month |
| YESSTR | LC\_MESSAGES | affirmative response string |
| NOSTR | LC\_MESSAGES | negative response string |

## RETURN VALUES

In a locale where langinfo data is not defined, **nl\_langinfo**() returns a pointer to the corresponding string in the POSIX locale. **nl\_langinfo\_l**() returns the same values as **nl\_langinfo**(). In all locales, **nl\_langinfo**() returns a pointer to an empty string if *item* contains an invalid setting.

## EXAMPLES

For example:

```
nl_langinfo(ABDAY_1)
```

would return a pointer to the string "Dom" if the identified language was Portuguese, and "Sun" if the identified language was English.

## SEE ALSO

[setlocale(3)](/setlocale/3.md)

## STANDARDS

The **nl\_langinfo**() function conforms to Version 2 of the Single UNIX Specification (“SUSv2”). The **nl\_langinfo\_l**() function conforms to IEEE Std 1003.1-2008 (“POSIX.1”).

## HISTORY

The **nl\_langinfo**() function first appeared in FreeBSD 4.6.
