nl_langinfo(), nl_langinfo_l()

get locale language information 

Function


SYNOPSIS

#include <langinfo.h>

char *nl_langinfo(nl_item item);

char *nl_langinfo_l(nl_item item, locale_t locale);


DESCRIPTION

The nl_langinfo() function returns a pointer to a null terminated string containing information relevant to a particular language or cultural area defined in the program's locale. Calls to setlocale() with a category corresponding to the category of the specified item, or to the category LC_ALL, may overwrite the array pointer to by the return value. setlocale() must be called at least once before the first call to nl_langinfo().

nl_langinfo_l() behaves in the same way as nl_langinfo() without the _l suffix, but uses the specified locale rather than the global or per-thread locale. A locale_t is returned by newlocale().

The requested item can be any of the following:

ABDAY_1 
ABDAY_2 
ABDAY_3 
ABDAY_4 
ABDAY_5 
ABDAY_6 
ABDAY_7 

Abbreviated name of the first through seventh day of the week, respectively.

ABMON_1 
ABMON_2 
ABMON_3 
ABMON_4 
ABMON_5 
ABMON_6 
ABMON_7 
ABMON_8 
ABMON_9 
ABMON_10 
ABMON_11 
ABMON_12 

Abbreviated name of the first through twelfth month of the year, respectively.

ALT_DIGITS 

Alternative symbols for digits.

AM_STR 

Ante Meridian affix string.

CODESET 

Codeset name for the current locale.

CRNCYSTR 

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.

D_FMT 

Date format string.

D_T_FMT 

String for formatting date and time.

DAY_1 
DAY_2 
DAY_3 
DAY_4 
DAY_5 
DAY_6 
DAY_7 

Long-form name of the first through seventh day of the week, respectively

ERA 

Era description segments.

ERA_D_FMT 

Era date format string.

ERA_D_T_FMT 

Era date and time format string.

ERA_T_FMT 

Era time format string.

MON_1 
MON_2 
MON_3 
MON_4 
MON_5 
MON_6 
MON_7 
MON_8 
MON_9 
MON_10 
MON_11 
MON_12 

Long-form name of the first through twelfth month of the year, respectively.

NOEXPR 

Regular expression matching a negative response to a yes/no question.

NOSTR 

String corresponding to a negative response to a yes/no question (deprecated).

PM_STR 

Post Meridian affix string.

RADIXCHAR 

Radix character.

T_FMT 

Time format string.

T_FMT_AMPM 

a.m. or p.m. time format string.

THOUSEP 

Separator for thousands.

YESEXPR 

Regular expression matching an affirmative response to a yes/no question.

YESSTR 

String corresponding to an affirmative response to a yes/no question (deprecated).


PARAMETERS

item 

Is one of the constants listed in the DESCRIPTION section.


RETURN VALUES

The function returns a pointer to a null terminated string. If the specified item is not defined in the current locale, the corresponding string in the POSIX locale is returned. If the parameter item is not valid, nl_langinfo() returns a pointer to an empty string.


CONFORMANCE

nl_langinfo() conforms to UNIX 98, with exceptions.


MULTITHREAD SAFETY LEVEL

MT-Safe, with exceptions.

The function nl_langinfo() is MT-Safe as long as no thread calls setlocale() while this function is executing.

The function nl_langinfo_l() is MT-Safe as long as no thread calls freelocale() on locale while this function is executing.


PORTING ISSUES

The NuTCRACKER Platform uses the native Windows locale databases for the data returned by nl_langinfo(). The Windows locale databases do not support affirmative and negative response expressions or strings (YESEXPR, YESSTR, NOEXPR, NOSTR), (unless the Windows language for the locale is installed) so the POSIX locale strings are always returned. The Windows locale databases do not support Era specifications for times, so the POSIX locale strings (which are empty) are always returned.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
localeconv(), newlocale(), setlocale(), strftime(), strftime_l()


PTC MKS Toolkit 10.4 Documentation Build 39.