Managing The LANG Environment Variable

There are three ways to set the LANG environment variable, depending on how you want the locale to operate:

  1. Customize the /etc/dt/config/Xconfig file. This method is used to set the locale system-wide, for all users and all sessions.

  2. Customize the .dtprofile file. This method is used for a specific user who might need a different locale profile.

  3. Choose a locale from the Options menu from the CDE login screen which changes the locale for that session.



Setting the Locale for Multiple Users ( Xconfig file)

To set the system-wide default language settings, you must edit the Xconfig file. This sets the CDE login screen and the proper LANG variable for all users. This is the only way to change LANG for all displays in multi-display systems. Here is the procedure:

  1. Check to see if the /etc/dt/config/Xconfig file exists on your system. If not, copy it from /usr/dt/config/Xconfig . Do not try to edit the /usr/dt/config/Xconfig file directly.

  2. Edit the /etc/dt/config/Xconfig file and change the following line (see Appendix A for a listing of all locales):

    Dtlogin*language: <lang>

    For example:

    • To set the German iso8859-1 locale for all displays/users:

      Dtlogin*language: de_DE.iso88591

    • To set the German iso8859-1 locale for a specific display ('hpabcd'):

      Dtlogin.hpabcd_0.language: de_DE.iso88591

    CAUTION: Make sure you DO NOT include a space or tab at the end of the <lang> value ( de_DE.iso88591 ). This will cause the LANG variable to be incorrect and the locale will not be set properly.
  3. Then execute: /sbin/init.d/dtlogin.rc reset

  4. Log out and login again

The Dtlogin client reads the appropriate message catalog for that locale and brings up the localized CDE login screen, if the user interface has been localized for the chosen locale. Otherwise, the login screen will come up in English. The Dtlogin client then determines the list of locales using the following resource in the /etc/dt/config/Xconfig file:

  • Dtlogin*languageList



Setting the Language for One User ( .dtprofile file)

An individual user can override the system-wide LANG setting by changing his/her homedirectory /.dtprofile file. In this case, the login screen is not localized and LANG is set only for the current user.

Here is the procedure for customizing the .dtprofile file:

  1. login user

  2. Go to your HOME directory

  3. Edit the .dtprofile file

    Add/Change the LANG environment variable.

    For example:

    • To set the locale to the French iso8859-1 locale

      LANG=fr_FR.iso88591

  4. Save and exit

  5. Log out and login again.



Setting the Locale for One Session (CDE Options menu)

To set the locale for one session, use the Options menu of the CDE Login Manager (the screen you see when you are ready to login to the system). By choosing a locale from this list, the LANG variable is set for the user on a per-login basis. The value of the LANG variable returns to its default value (as set in dtlogin , see above) when the user logs out at the end of the session.



Setting Default LANG on a Terminal Based System

Default language/codeset settings for terminal based systems are made by modifying the .profile or .cshrc file in the user's home directory. For example:

  • To set the user's default login to the German utf8 locale, modify the following lines:

    When using sh or ksh , edit the .profile file as follows:

        LANG=de_DE.utf8
    export LANG

    When using csh , edit the .cshrc file as follows:

        setenv LANG de_DE.utf8
  • To set the user's default login to the Canadian French iso8859-1 locale, make the following modifications.

    When using sh or ksh , edit the .profile file as follows:

        LANG=fr_CA.iso88591
    export LANG

    When using csh , edit the .cshrc file as follows:

        setenv LANG fr_CA.iso88591