[ Previous | Next | Contents | Glossary | Home | Search ]
AIX Version 4.3 Base Operating System and Extensions Technical Reference, Volume 1

nl_langinfo Subroutine

Purpose

Returns information on the language or cultural area in a program's locale.

Library

Standard C Library (libc.a)

Syntax

#include <nl_types.h>
#include <langinfo.h>
char *nl_langinfo (Item)
nl_item Item;

Description

The nl_langinfo subroutine returns a pointer to a string containing information relevant to the particular language or cultural area defined in the program's locale and corresponding to the Item parameter. The active language or cultural area is determined by the default value of the environment variables or by the most recent call to the setlocale subroutine. If the setlocale subroutine has not been called in the program, then the default C locale values will be returned from nl_langinfo.

Values for the Item parameter are defined in the langinfo.h file.

The following table summarizes the categories for which nl_langinfo() returns information, the values the Item parameter can take, and descriptions of the returned strings. In the table, radix character refers to the character that separates whole and fractional numeric or monetary quantities. For example, a period (.) is used as the radix character in the U.S., and a comma (,) is used as the radix character in France.

Category Value of item Returned Result
LC_MONETARY CRNCYSTR Currency symbol and its position.
LC_NUMERIC RADIXCHAR Radix character.
LC_NUMERIC THOUSEP Separator for the thousands.
LC_MESSAGES YESSTR Affirmative response for yes/no queries.
LC_MESSAGES NOSTR Negative response for yes/no queries.
LC_TIME D_T_FMT String for formatting date and time.
LC_TIME D_FMT String for formatting date.
LC_TIME T_FMT String for formatting time.
LC_TIME AM_STR Antemeridian affix.
LC_TIME PM_STR Postmeridian affix.
LC_TIME DAY_1 through DAY_7 Name of the first day of the week to the seventh day of the week.
LC_TIME ABDAY_1 through ABDAY-7 Abbreviated name of the first day of the week to the seventh day of the week.
LC_TIME MON_1 through MON_12 Name of the first month of the year to the twelfth month of the year.
LC_TIME ABMON_1 through ABMON_12 Abbreviated name of the first month of the year to the twelfth month.
LC_CTYPE CODESET Code set currently in use in the program.
Note: The information returned by the nl_langinfo subroutine is located in a static buffer. The contents of this buffer are overwritten in subsequent calls to the nl_langinfo subroutine. Therefore, you should save the returned information.

Parameter

Item Information needed from locale.

Return Values

In a locale where language information data is not defined, the nl_langinfo subroutine returns a pointer to the corresponding string in the C locale. In all locales, the nl_langinfo subroutine returns a pointer to an empty string if the Item parameter contains an invalid setting.

The nl_langinfo subroutine returns a pointer to a static area. Subsequent calls to the nl_langinfo subroutine overwrite the results of a previous call.

Implementation Specifics

This subroutine is part of Base Operating System (BOS) Runtime.

Related Information

The localeconv subroutine, rpmatch subroutine, setlocale subroutine.

Subroutines Overview, National Language Support Overview for Programming, and Understanding Locale Subroutines in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.


[ Previous | Next | Contents | Glossary | Home | Search ]