Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exec(2)

catopen(3int)

intro(3int)

setlocale(3)

lang(5int)

environ(5int)

Name

environ − natural language support (NLS) environment variables

Description

The international environment variables are defined for the ULTRIX system and are additional to those described in the ULTRIX reference pages, Sections 2 (system calls) and 3 (routines), and the environ() reference page. The international variables are made available to a process by exec.

This reference page is divided into two sections.  The first section describes environment variables that can control the locale setting.  The second section describes the variables that control where the catopen function searches for message catalogs and where the setlocale function searches for language databases.

Environment Variables That Control the Locale Setting

The LANG, LC_COLLATE, LC_TYPE, LC_NUMERIC, LC_TIME, and LC_MONETARY environment variables can control the locale setting.  You define these variables using the same format as the locale argument to the setlocale function.  The following shows the format you use:

language[_territory[.codeset]][@modifier]

In language, you specify the native language of the user.  You can optionally specify the user’s dialect and codeset using _territory and codeset. For example, the following definition of LANG specifies the French native language, as spoken in France (as opposed to in Switzerland), and the Digital Multinational Character Set:

LANG = FRE_FR.MCS

In @modifier, you specify a specific instance of localization data within a single category. For example, using @modifier, you can specify telephone directory ordering of data, as opposed to dictionary ordering of data.  You cannot use @modifier to define the LANG variable. 

The following list describes the environment variables that control the locale setting:

LANGIdentifies the user’s requirements for native language, local customs, and coded character set. At run time, you can bind the user’s language requirements, as specified by the setting of LANG, to the execution of a program by calling setlocale, as follows:

setlocale (LC_ALL, "");

If LANG is not defined in the current environment, the locale defaults to the C locale. For more information on the C locale, see the POSIX Conformance Document. 

System administrators can define LANG to provide a  default setting for the system as a whole, or user’s can define LANG individually using standard command interpreter facilities.

LC_COLLATEContains the user’s requirements for language, territory, and codeset for the character collation format.  LC_COLLATE affects the behavior of regular expressions and the string collation functions in strcoll and strxfrm. If LC_COLLATE is not defined in the current environment, LANG provides the necessary default.

LC_CTYPEContains the user’s requirements for language, territory, and codeset for the character classification and conversion format.  LC_CTYPE affects the behavior of the character-handling functions in conv and ctype. If LC_CTYPE is not defined in the current environment, LANG provides the necessary default.

LC_MONETARY
Contains the user’s requirements for language, territory, and codeset for the monetary format. LC_MONETARY affects the currency string in nl_langinfo. If LC_MONETARY is not defined in the current environment, LANG provides the necessary default.

LC_NUMERICContains the user’s requirements for language, territory, and codeset for the numeric data presentation format.  LC_NUMERIC affects the radix and thousands separator character for the formatted I/O functions in printf, scanf, nl_printf, nl_scanf, and the string conversion functions in ecvt and atol. If LC_NUMERIC is not defined in the current environment, LANG provides the necessary default.

LC_TIMEContains the user’s requirements for language, territory, and codeset for the time format.  LC_TIME affects the behavior of the time functions in strftime. If LC_TIME is not defined in the current environment, LANG provides the necessary default.

Environment Variables That Specify Locations

The NLSPATH and INTLINFO environment variables control where the catopen and setlocale functions search for message catalogs and the language databases. You define these variables using a pathname or set of pathnames.  The pathnames can contain variable elements, called substitution fields, that allow your program or the setting of other environment variables to affect the setting of NLSPATH and INTLINFO.  The following shows the format you use to define these variables:

variable-name="[:][/directory][/substitution field]
           [/file-name][:alternate-pathname][:..."

You specify either NLSPATH or INTLINFO in place of variable-name.

A colon (:) that precedes other parts of any pathname in the definition specifies the current directory. 

In directory, you can specify a specific directory in which the function searches.  If you need the environment variable to be flexible, you can use a substitution field in place of or with directory names.  A substitution field consists of a percent sign (%), followed by a code letter. The substitution fields you can use are as follows:

%NThe value of the name argument you pass to catopen

%LThe value of the LANG environment variable

%lThe language element from LANG

%tThe territory element from LANG

%cThe codeset element from LANG

%%A literal percent sign

If a substitution field you specify is currently undefined, catopen or setlocale substitutes a null string.  Neither function includes the underscore (_) or period (.) separator in %t or %c substitutions.

You can specify more than one pathname when you define these environment variables.  You separate each pathname from the one that follows it using a colon (:).  If you need to specify the current directory in a pathname other than the first pathname in the list, use a double colon (::).  The functions interpret the first colon as a separator between pathnames and the second colon as specifying the current directory. 

The following describes the ICONV, INTLINFO, and NLSPATH environment variables:

ICONVThe ICONV environment variable stores the directory pathname for the conversion codesets used by the iconv command. If this variable is undefined, iconv searches the /usr/lib/intln/conv directory.

The following example shows how to define ICONV:

ICONV=/usr/lib/international/conversions

In this example, ICONV is defined as the directory pathname /usr/users/international/conversions.

INTLINFO
The INTLINFO environment variable stores the location of the language database. The setlocale function reads INTLINFO when it searches for the database.

The following example shows how to define INTLINFO:

INTLINFO = ":%L:/usr/lib/intln/%L:/usr/lib/intln/ENG_%t.%c"

In this example, the setlocale function searches for the language database named in the LANG environment variable. The function searches for the variable in the current directory. If the database is not in the current directory, setlocale searches in the /usr/lib/intln directory for that same database. Finally, if the database specified by LANG is unavailable, setlocale searches in /usr/lib/intln for the English language database that matches the current territory and codeset.

NLSPATHThe NLSPATH environment variable controls where the catopen function searches for a message catalog.

The following example shows defines NLSPATH:

NLSPATH=":%N.cat:/nlslib/%N.cat:nlslib/program.cat"

This definition causes catopen to search in the current directory for the message catalog named in the name argument you pass.  If the function cannot find the message catalog in the current directory, it searches in the /nlslib directory.  If the catalog is not in that directory, catopen opens the /nlslib/program.cat message catalog.

See Also

exec(2), catopen(3int), intro(3int), setlocale(3), lang(5int)
Guide to Developing International Software

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