Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ locale(5P) — Interactive 2.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

localeconv(3P)

setlocale(3P)

cftime(4)

chrtbl(1)



          locale(5P)       INTERACTIVE UNIX System (POSIX)       locale(5P)



          NAME
               locale - define and set international environment

          DESCRIPTION
               A locale is made up from one or more categories.  Each
               category is identified by its name, and controls specific
               aspects of the behavior of components of the system.
               Category names correspond to the following environment vari-
               able names.

               LC_CTYPE        Affects the behavior of the character han-
                               dling functions.

               LC_TIME         Affects the behavior of the strftime func-
                               tion.

               LC_NUMERIC      Affects the decimal-delimiter character for
                               the formatted input/output functions and the
                               string conversion functions, as well as the
                               non-monetary formatting information returned
                               by the localeconv function.

               LC_MONETARY     Affects the monetary formatting information
                               returned by the localeconv function.

               Programs compiled with the -Xp option can use the setlocale
               function to modify the environment.  When the program
               starts, the environment is set to the C locale, which
               corresponds to the traditional UNIX System environment.
               Programs can modify this environment by using the setlocale
               function.

               If so directed by the program, the values of the above
               environment variables will be used to set the environment.
               The value assigned to the environment variable LANG will be
               used as the value for any of the above variables for which
               no valid value is assigned.  If LANG is set to a valid
               value, and none of the above variables are set, then the
               entire environment will be set to the value indicated by
               LANG.

               The information that defines a specific locale must be
               stored in data files on the system.  The information for
               each category is stored in a file with a name corresponding
               to the environment variable names.  The default location is
               within a directory under /lib/locale.  The name of the
               directory is the name of the locale:

                           /lib               .

                          /locale               .

                      locale-1  locale-2   locale-3        ...         .


          Rev. 1.1                                                   Page 1





          locale(5P)       INTERACTIVE UNIX System (POSIX)       locale(5P)



               .....

                    .....              .                   .

                 LC_CTYPE     LC_TIME   LC_NUMERIC   LC_MONETARY

             Creating a Locale
               The following steps are used to create the locale informa-
               tion.

               locales installed under /lib/locale should be viewed as
               ``public'' locales; all others should be considered private.
               Installation procedures are the same for both private and
               public locales.  Only the system administrator should be
               able to create, modify, or delete public locales.

               As a first step, create a directory with the desired name of
               the locale within /lib/locale (or, in case of a private
               locale, the appropriate directory).  Then, the individual
               categories should be created as described in the following
               sections.

             LC_CTYPE
               The information in the LC_CTYPE file is generated via the
               chrtbl utility.  After executing the chrtbl utility, the
               generated data file must be copied or moved to the locale
               directory and given the name of LC_CTYPE.  As an example,
               assume that the name or the desired locale is fr_CH.8859,
               and the chrclass value in the character classification table
               is swiss, then the following steps should be performed:

                    $chrtbl          sourcename
                    $cp  swiss     /lib/locale/fr_CH.8859/LC_CTYPE

             LC_TIME
               The information in the LC_TIME file is in text format as
               described in cftime(4).  Instead of being placed in the
               /lib/cftime directory, the file must be given the name of
               LC_TIME and placed under the locale directory.

               Example:

               Jan
               Feb
                ...
               Dec
               January
               February
                ...
               December
               Sun
               Mon
                ...


          Rev. 1.1                                                   Page 2





          locale(5P)       INTERACTIVE UNIX System (POSIX)       locale(5P)



               Sat
               Sunday
               Monday
                ...
               Saturday
               %H:%M:%S
               %m/%d/%y
               %a %b %d %T %Z %Y
               AM
               PM

             LC_NUMERIC
               The information in the LC_NUMERIC file is in text format.
               Each line in the text file contains a keyword and a value,
               separated by a space or a tab. Lines starting with a # are
               ignored.  The following keywords are recognized:

               LC_NUMERIC       This keyword must be the first in the file.

               decimal_point    The value is the character to be used as
                                decimal delimiter, enclosed in quote marks.

               thousands_sep    The value is the character used as
                                thousands separator.

               grouping         The value is a string of semicolon-
                                separated numbers, as described in
                                localeconv(3P).

               END LC_NUMERIC   This keyword must be the last in the file.

               Example:

               LC_NUMERIC
               decimal_point   "."
               thousands_sep   " "
               grouping        3;3;0
               END LC_NUMERIC

             LC_MONETARY
               The information in the LC_MONETARY file is in text format.
               Each line in the text file contains a keyword and a value,
               separated by a space or a tab. Lines starting with a # are
               ignored.  For a detail definition of the values, see
               localeconv(3P).  The following keywords are recognized:

               LC_MONETARY       This keyword must be the first in the
                                 file.

               int_curr_symbol   The value is the four-character string to
                                 be used as international currency symbol,
                                 enclosed in quote marks.



          Rev. 1.1                                                   Page 3





          locale(5P)       INTERACTIVE UNIX System (POSIX)       locale(5P)



               currency_symbol   The value is the character used as
                                 currency symbol.

               mon_decimal_point The value is the decimal point used to
                                 format monetary values.

               mon_thousands_sep The value is the separator used to format
                                 monetary values.

               mon_grouping      The value is a string of semicolon-
                                 separated numbers, as described in
                                 localeconv(3P).

               positive_sign     The string used to indicate a value for a
                                 non-negative formatted monetary quantity.

               negative_sign     The string used to indicate a negative-
                                 valued formatted monetary quantity.

               int_frac_digits   The number of fractional digits (those
                                 after the decimal point) to be displayed
                                 in an internationally formatted monetary
                                 quantity.

               frac_digits       The number of fractional digits (those
                                 after the decimal point) to be displayed
                                 in a formatted monetary quantity.

               p_cs_precedes     Set to 1 or 0 if the currency_symbol
                                 respectively precedes or succeeds the
                                 value for a non-negative formatted mone-
                                 tary quantity.

               p_sep_by_space    Set to 1 or 0 if the currency_symbol
                                 respectively is or is not separated by a
                                 space from the value for a non-negative
                                 formatted monetary quantity.

               n_cs_precedes     Set to 1 or 0 if the currency_symbol
                                 respectively is or is not separated by a
                                 space from the value for a negative for-
                                 matted monetary quantity.

               p_sign_posn       Set to a value indicating the positioning
                                 of the positive_sign for a non-negative
                                 formatted monetary quantity.

               n_sign_posn       Set to a value indicating the positioning
                                 of the negative_sign for a negative for-
                                 matted monetary quantity.

               END LC_MONETARY   This keyword must be the last in the file.



          Rev. 1.1                                                   Page 4





          locale(5P)       INTERACTIVE UNIX System (POSIX)       locale(5P)



               Example:

               LC_MONETARY
               int_curr_symbol "USD "
               currency_symbol "$"
               mon_decimal_point       "."
               mon_thousands_sep       " "
               mon_grouping    3
               negative_sign   "CR"
               int_frac_digits 2
               frac_digits             2
               p_cs_precedes   0
               p_sep_by_space  1
               n_cs_precedes   0
               n_sep_by_space  1
               n_sign_posn             1
               END LC_MONETARY

             Locale Naming Conventions and Usage
               X/Open recommends that locale names follow a certain conven-
               tion.  The recommended format is:

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

               where:

               language    Indicates the language area, e.g., Fr (for
                           French).

               territory   Indicates the geographical area, e.g., CH (for
                           Switzerland), which controls, for example, mone-
                           tary editing rules.

               codeset     Indicates the used code set, e.g., 8859.

               modifier    Can be used to distinguish between otherwise
                           identical names (for instance between two dif-
                           ferent collation sequences).

               Example:

               $LANG=Fr_CH.8859
               $LC_COLLATE=$HOME/mylocale

               In the above declarations, the default locale is a French-
               Swiss, using the 8859.1 codeset.  This is the locale chosen
               for all categories except LC_COLLATE, for which a
               ``private'' locale in the directory mylocale is chosen.







          Rev. 1.1                                                   Page 5





          locale(5P)       INTERACTIVE UNIX System (POSIX)       locale(5P)



          FILES
               /lib/locale/*              Default directory for locale
                                          directory structures (* is name
                                          of locale).
               /lib/locale/*/LC_CTYPE     Contains LC_CTYPE information.
               /lib/locale/*/LC_COLLATE   Contains LC_COLLATE information.
               /lib/locale/*/LC_NUMERIC   Contains LC_NUMERIC information.
               /lib/locale/*/LC_MONETARY  Contains LC_MONETARY information.
          SEE ALSO
               localeconv(3P), setlocale(3P), cftime(4).
               chrtbl(1) in the INTERACTIVE UNIX System User's/System
               Administrator's Reference Manual.











































          Rev. 1.1                                                   Page 6



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