Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ langinfo(3C) — HP-UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

nl_init(3C)

environ(5)

hpnls(5)

langid(5)

LANGINFO(3C)  —  HP-UX

NAME

nl_langinfo, langinfo, langtoid, idtolang, currlangid − NLS information about native languages

SYNOPSIS

#include <nl_types.h>
#include <langinfo.h>

char ∗nl_langinfo(item)
nl_item item;

char ∗langinfo(langid, item)
int langid;
nl_item item;

int langtoid(langname)
char ∗langname;

char ∗idtolang(langid)
int langid;

int currlangid()

DESCRIPTION

Nl_langinfo and langinfo retrieve a null-terminated string containing information unique to a language or cultural area identified by the last successful call to nl_init(3C). If nl_init(3C) has not been called successfully, or for langinfo, if langid is not defined or the NLS (Native Language Support) environment corresponding to that langid is not available, the default NLS environment, ­“n-computer”, is used (see langid(5)).

For example, nl_langinfo( DAY_1 ) returns a pointer to the string “Dom” if the NLS environment is set to “portuguese”, and “sun” if the NLS environment is set to “finnish”. 

The following items are defined in <langinfo.h>:

D_T_FMT String for formatting date(1). 

DAY_1 Name of the first day of the week (“Sunday” in English). 

. . . 

. . . 

DAY_7 Name of the seventh day of the week. 

ABDAY_1 Abbreviated name of the first day of the week (“Sun” in English). 

. . . 

. . . 

ABDAY_7 Abbreviated name of the seventh day of the week. 

MON_1 Name of the first month in the Gregorian year. 

. . . 

. . . 

MON_12 Name of the twelfth month. 

ABMON_1 Abbreviated name of the first month. 

. . . 

. . . 

ABMON_12 Abbreviated name of the twelfth month. 

RADIXCHAR Radix character (“decimal point” in English). 

THOUSEP Separator for thousands. 

YESSTR Affirmative response for yes/no questions. 

NOSTR Negative response for yes/no questions. 

CRNCYSTR Symbol for currency preceded by “-” if it precedes the number, “+” if it follows the number, and “.” if it replaces the radix.  For example, ­“-DM” would be used for German, “+ Kr” for Danish, and ­“.$” for Portuguese. 

BYTES_CHAR
Maximum number of bytes per character for the character set used for the specified language.  For example, “1” for English and most European languages, and “2” for Japanese and several other Asian languages.

DIRECTION Value to indicate text direction.  Values currently defined include “null”, “0” and “1”.  Values of “null” or “0” indicate that characters are arranged from left-to-right within a line and lines are arranged from top-to-bottom.  A value of “1” indicates that characters are arranged from right-to-left within a line and lines are arranged from top-to-bottom. 

ALT_DIGITS A string of the characters that are mapped into the ASCII equivalent string “0123456789b+-.,eE” (where b is a blank).  This is also the reverse mapping for output.  The radix character given in the string must agree with the character defined in the RADIXCHAR field described above.  It is not assumed that the character code values of digits are contiguous or that they are one byte values.  A null value for the string indicates that the language has no alternative digits. 

ALT_PUNCT A string of the characters that are mapped into the ASCII equivalent string “b!"#$%&’()*+,-./:;<=>?@[]^_‘{|}~” (where b is a blank) in American usage.  This is also the reverse mapping for output.  It is not assumed that the character code values of punctuation characters are contiguous or that they are one byte values.  If any punctuation characters do not have equivalent alternatives, ASCII codes are used in the alternative punctuation string.  A null value for the string indicates that the language has no alternative punctuation characters. 

AM_STR Equivalent symbols for AM (before noon).  This is used with 12-hour time format. 

PM_STR Equivalent symbols for PM (after noon). 

YEAR_UNIT Symbol for year.  This is usually required to specify date for Asian languages. 

MON_UNIT Symbol for month. 

DAY_UNIT Symbol for day. 

HOUR_UNIT Symbol for hour.  This is usually required to specify time for Asian languages. 

MIN_UNIT Symbol for minute. 

SEC_UNIT Symbol for second. 

If an invalid item is specified, a pointer to an empty string is returned.  An empty string can also be returned for a valid item, if that item is not applicable to the language or customs of the currently loaded NLS environment.  For example, a thousands separator is not used when writing numbers according to the customs associated with the Arabic language. 

Currlangid looks for a LANG string in the user’s environment.  If it finds one, currlangid returns the corresponding integer listed in langid(5). Otherwise, it returns 0 to indicate a default to native-computer, the method used before NLS was available. 

Idtolang takes the integer langid and attempts to return the corresponding character string defined in langid(5). If langid is not found, an empty string is returned. 

Langtoid is the inverse of idtolang: it attempts to convert a string to a language ID, returning 0 to indicate native-computer if no match is found. 

WARNINGS

Nl_langinfo and langinfo return a pointer to a static area that is overwritten on each call. 

Langinfo is provided for historical reasons only.  Use of nl_langinfo is recommended. 

Langinfo effectively calls langinit (see nl_init(3C)) to load the NLS environment according to the language specified by langid.

AUTHOR

Langinfo was developed by HP. 

SEE ALSO

nl_init(3C), environ(5), hpnls(5), langid(5). 

INTERNATIONAL SUPPORT

8- and 16-bit data. 

Hewlett-Packard Company  —  May 11, 2021

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026