[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Commands Reference, Volume 1

chlang Command

Purpose

Changes the language settings for system or user.

Syntax

To Modify the Environment or Profile File Changing the Default Language Setting:

chlang-u UID Uname ] [  -m MsgTransLst -M ] Language

To Modifiy the Environment or Profile File without Changing the Default Language Setting:

chlang-u UID Uname ]   -m MsgTransLst -M 

To Remove the NLSPATH Setting from the Environment or Profile File:

chlang -d-u UID UName ]

Description

The chlang command is a high-level shell command that changes the language settings for either the entire system or an individual user. If the effective id of the invoker is root and the -u option was not used, the language settings will be changed for the entire system in the /etc/environment file. If the effective id of the invoker is not root, or if the -u option was used, the language settings will be changed for an individual user in the user's .profile file.

When chlang is run with a language and no options, the LANG environment variable will be set to the language specified.

When chlang is run with the -m option, the LANG and NLSPATH environment variables will be set. In addition, the LC_MESSAGES variable will be set to the first value specified in the MsgTransLst of the -m flag if it is different from the Language parameter and the Language parameter has a system supplied translation available.

When chlang is run with the -d option, the NLSPATH environment variable will be removed.

Notes:
  1. Changes made to the NLS environment by chlang are not immediate when either /etc/environment or the user's .profile are modified. Changes to /etc/environment requires rebooting the sytsem. Changes to a user's .profile requires logging in again or running the .profile file.
  2. When modifying a user's configuration file, if the user uses the C shell (/usr/bin/csh) their .cshrc file will be modified rather than the .profile file.

Flags

-d Used to remove the NLSPATH environment variable. This option will remove NLSPATH from either /etc/environment or the user's .profile. If NLSPATH was not currently in the file being modified, a warning message will be displayed.
-m MsgTransLst Used to make modifications to the NSLPATH environment variable. MsgTransLst is a colon-separated list of message translations (locale names) that indicates the message translation hierarchy required for the system or user. If the first language in the list is different from the Language parameter and Language parameter has system supplied translation, then the LC_MESSAGES environment variable will be set to that first value. If the first language-territory in the list is the same as the language being set, the LC_MESSAGES environment variable will be removed. All entries in the list become hard coded directories in the NLSPATH environment.
-M Used to reset the LC_MESSAGES environment variable and set the NLSPATH environment variable to the default translation hierarchy, which is:

/usr/lib/nls/msg/%L/%N:
/usr/lib/nls/msg/%L/%N.cat:
-u UID or UName Used to make modification to an individual user. The user can be specified by either user id number or user login name. If the effective id of chlang is root, the -u parameter must be used to change the language environment for any specific user ID, including root itself (no -u parameter in this case will update the /etc/environment file rather than root's .profile). If the effective id is not root, the -u parameter is not needed. If it is specified, it must be equal to the effective id of the invoker.
Language This is the language-territory (locale name) that will become the locale setting for the LANG environment variable.

Exit Status

0 Indicates successful completion.
>0 Indicates an error occurred.

Examples

  1. Assume the preferred locale is Norwegian, and the language translations in order of preference are Norwegian, Swedish, and English. The command to achieve this for user amcleod is as follows:

    chlang -u amcleod -m no_NO:sv_SE:en_US no_NO

    The following settings would be made in the .profile for user amcleod. Because the first language in the message translation list is Norwegian, as is the Language parameter, LC_MESSAGES would not be set by chlang. If LC_MESSAGES had been set, it would be removed:

    LANG=no_NO
      
    NLSPATH=/usr/lib/nls/msg/%L/%N:
            /usr/lib/nls/msg/no_NO/%N:
            /usr/lib/nls/msg/sv_SE/%N:
            /usr/lib/nls/msg/en_US/%N:
            /usr/lib/nls/msg/%L/%N.cat:
            /usr/lib/nls/msg/no_NO/%N.cat:
            /usr/lib/nls/msg/sv_SE/%N.cat:
            /usr/lib/nls/msg/en_US/%N.cat
  2. Assume the preferred locale is French, and the language translations in order of preference are French Canadian and English. To achieve this for a non-root user enter:

    chlang -m fr_CA:en_US fr_FR

    The following settings would be made in the .profile file for the user invoking chlang. Because the first language in the message translation list is different from the cultural convention (locale), LC_MESSAGES is set by chlang.

    LANG=fr_FR
     
    LC_MESSAGES=fr_CA
     
    NLSPATH=/usr/lib/nls/msg/%L/%N:
            /usr/lib/nls/msg/fr_CA/%N:
            /usr/lib/nls/msg/en_US/%N:
            /usr/lib/nls/msg/%L/%N.cat:
            /usr/lib/nls/msg/fr_CA/%N.cat:
            /usr/lib/nls/msg/en_US/%N.cat
  3. Assume that a system administrator (root authority) in Spain is configuring a system from another country, and needs to change the default language environment so the machine operates properly in its new location. To change the default in the /etc/environment file, enter:

    chlang -m es_ES es_ES

    The following settings would be made in the /etc/environment file.

    LANG=es_ES
     
    NLSPATH=/usr/lib/nls/msg/%L/%N:
            /usr/lib/nls/msg/es_ES/%N:
            /usr/lib/nls/msg/%L/%N.cat:
            /usr/lib/nls/msg/es_ES/%N.cat

Files

/usr/bin/chlang Change language command
/etc/environment Specifies basic environment for all processes
$HOME/.profile Specifies environment for specific user needs

Related Information

The environment file, profile file format.

National Language Support Overview in AIX 5L Version 5.2 National Language Support Guide and Reference.

Understanding Locale Environment Variables in AIX 5L Version 5.2 System Management Guide: Operating System and Devices.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]