Common Desktop Environment: Advanced User's and System Administrator's Guide

# 16 Configuring Localized
Desktop Sessions

Contents of Chapter:

Managing the LANG Environment Variable
  Setting the Language for Multiple Users
  Setting the Language for One Session
  Setting the Language for One User
  LANG Environment Variable and Session Configuration
  Setting Other NLS Environment Variables

Finding Fonts

Localizing app-defaults Resource Files

Localizing Actions and Data Types

Localizing Icons and Bitmaps

Localizing Backdrop Names

Localizing Palette Names

Localizing Help Volumes

Localizing Message Catalogs

Executing Localized Desktop Applications Remotely

Resetting Your Keyboard Map

To configure localized desktop sessions, you will need to:

- Set the LANG environment variable and other National Language Support (NLS) environment variables

- Access language-dependent message catalogs and resource files

- Execute applications remotely across internationalized systems

## Managing the LANG Environment Variable

The LANG environment variable must be set for the desktop to use the operating system's language-sensitive routines. The desktop supports:

- Western Europe, Latin-based languages
- Japanese
- Traditional Chinese
- Simplified Chinese
- Korean

Note: Support for other languages may have been added by your desktop vendor.

You can set LANG to any value supported by the operating system. The Options menu in the login screen displays the list of supported languages and territories.

There are four ways to set LANG for the desktop:

- By editing a resource in the `Xconfig` file

- Using the Options menu in the login screen

- By creating an executable `sh` or `ksh` `Xsession.d` script. (See"Sourcing Xsession.d Scripts" for more information about using an Xsession.d script.)

- By editing the user's `.dtprofile` file

When LANG is set, the desktop uses the following language-dependent files to determine the localized interface.

Colors
  `/usr/dt/palettes/desc`.language

Backdrops
  `/usr/dt/backdrops/desc`.language

### Setting the Language for Multiple Users

If you set the language by means of an `Xconfig` file, the login screen is localized and LANG is set for all users. This is the only way to change LANG for all displays in multi-display systems. (To modify `Xconfig` , copy `/usr/dt/config/Xconfig` `` to `/etc/dt/config/Xconfig.)`

The language is set by placing the following line in `/etc/dt/config/Xconfig`:

    dtlogin.host_display.language: language

For example, the following line sets LANG to `Swedish_locale` on display `my_host:0`.

    dtlogin.my_host_0.language: Swedish_locale

The `dtlogin` client reads the appropriate message catalog for that language and brings up the localized login screen. The `dtlogin` client then determines the list of locales using the following resources in the `/etc/dt/config/Xresources` resource file:

- `dtlogin*language`
- `dtlogin*languageList`
- `dtlogin*languageName`

The `Xconfig` file may need to set the NLSPATH environment variable appropriately for the chosen language. If this is not the case, or if you want to set NLSPATH yourself, see "NLSPATH Environment Variable" .

### Setting the Language for One Session

To set the language for one session, use the login screen Options menu. The login screen is localized and LANG is set for the user. LANG returns to its default value (set in `dtlogin` ) at the conclusion of the session.

### Setting the Language for One User

A user can override the login's LANG setting within the HomeDirectory`/.dtprofile` file. The login screen is not localized, and LANG is set for the user.

- If you use `sh` or `ksh`:

      LANG=language
      export LANG

- If you use `csh`:

      setenv LANG language

### LANG Environment Variable and Session Configuration

`The LANG environment variable changes the directory name that is searched for your session configuration files.`

`The localized session configuration files are:`

- `/usr/dt/config/`language`/Xresources` (Login Manager resource file)
- `/usr/dt/config/`language`/sys.font` (Session Manager resource file)
- `/usr/dt/config/`language`/sys.resources` (Session Manager resource file)
- `/usr/dt/config/`language`/sys.session` (Session Manager executable shell)
- `/usr/dt/config/`language`/sys.dtwmrc` (Window Manager resource file)
- `/usr/dt/appconfig/types/`language`/dtwm.fp` (Window Manager Front Panel)

### Setting Other NLS Environment Variables

Besides LANG, there are other NLS environment variables such as LC_CTYPE and LC_ALL. These variables are not affected by the `dtlogin` language resource nor by the login screen Options menu. They must be set in the following files:

- System-wide variables: `/etc/dt/config/Xsession.d`
- Personal variables: HomeDirectory`/.dtprofile`

#### NLSPATH Environment Variable

The NLSPATH environment variable determines the directory paths that applications search for message catalogs. Both LANG and NLSPATH must be set to use those message catalogs. Refer to "Localizing Message Catalogs" for the location of localized messages. Most desktop clients will prefix the path to NLSPATH upon startup.

## Finding Fonts

Fonts included with the desktop are in the `/usr/lib/X11/fonts` directory. Each directory contains a directory file, `fonts.dir` , and an alias file, `fonts.alias` . See the `mkfontdir` man page for information on creating the `fonts.dir` and `fonts.alias` files.

To list all fonts available at a server, user the `xlsfonts` command. To add or delete fonts to the server, use the `xset` command.

## Localizing app-defaults Resource Files

The default location for the `app-defaults` file for the desktop clients is `/usr/dt/app-defaults/` language . For example, if LANG is set to `Swedish_locale` , then applications will look for their `app-defaults` file in `/usr/dt/app-defaults/Swedish_locale` . If LANG is not set, language is ignored, and applications look for their `app-defaults` file in `/usr/app-defaults/C` .

To change the location of `app-defaults` , use the XFILESEARCHPATH environment variable. For example, to move `app-defaults` to `/users` , set XFILESEARCHPATH to `/usr/app-defaults/` language `/` classname .

If you set XFILESEARCHPATH in HomeDirectory `/.dtprofile` , the value applies to all desktop and X clients you run. Nonclients will not find their resource files unless you link or copy them into the directory specified by XFILESEARCHPATH.

## Localizing Actions and Data Types

Note: To customize a file in the `/usr/dt/appconfig` directory, copy the file to the `/etc/dt/appconfig` directory prior to customizing.

The search path for action and data-type definition files includes language-dependent directories in:

- Personal: HomeDirectory`/dt/types`
- System-wide: `/etc/dt/appconfig/types/`language
- Built-in:`/usr/dt/appconfig/types/`language

The search path for Application Manager's configuration files is:

- Personal: Ho meDirectory`/dt/appmanager`
- System-wide: `/etc/dt/appconfig/appmanager/`language
- Built-in: `/usr/dt/appconfig/appmanager/`language

File and directory names in this directory are localized.

## Localizing Icons and Bitmaps

To localize an icon, edit the icon with Icon Editor and save it in:

    /etc/dt/appconfig/icons/language

If you save it in a different directory, set the XMICONSEARCHPATH environment variable to include the directory where you saved the icon. The XMICONBMSEARCHPATH environment variable controls the path used to search for icons.

## Localizing Backdrop Names

Localization of backdrops is done through the use of description files (`desc` .language and `desc.backdrops` ). No specific localized directory exists (such as `/usr/dt/backdrops/` language ) for backdrop files. All locales use the same set of backdrops files but have their own `desc.` language file containing the translated names of the backdrops.

The description file contains resource specifications for the backdrop names that are translated. For example:

    Backdrops*Corduroy.desc:    Velours
    Backdrops*DarkPaper.desc:   PapierKraft
    Backdrops*Foreground.desc:  AvantPlan

The `desc.` language file is used to retrieve the description of the backdrops for locale language in order to display the backdrop in the Style Manager. If there is a description specification, it will be displayed in the Style Manager backdrops list. Otherwise, the backdrop file name will be used.

Users can add their own backdrop descriptions in the HomeDirectory `/.dt/backdrops/desc.backdrops` file. This file is used to retrieve the backdrop descriptions for all backdrops added by the user regardless of locale.

The search path for the `description` files is:

- Personal: HomeDirectory`/.dt/backdrops/desc.backdrops`
- System-wide: `/etc/dt/backdrops/desc.`language
- Built-in: `/usr/dt/backdrops/desc.`language

## L ocalizing Palette Name s

Localization of palettes is done through the use of description files (`desc` .language and `desc.palettes` ). No specific localized directory exists (such as `/usr/dt/palettes/` language ). All locales use the same set of palette files but have their own `desc.palettes` file containing the translated names of the palettes.

The description file contains resource specifications for the palette names that are translated. For example:

    Palettes*Cardamon.desc:    Cardamone
    Palettes*Cinnamon.desc:    Cannelle
    Palettes*Clove.desc:       Brun

The `desc.` language file is used to retrieve the description of the palettes for locale language in order to display the palette in the Style Manager list. If there is a description specification it will be displayed in the Style Manager palettes list. Otherwise, the palette file name will be used.

Users can add their own palette descirptions in the HomeDirectory `/.dt/palettes/desc.palettes` file. This file is used to retrieve the palette descriptions for all palettes added by the user regardless of locale.

The search path for the description files is:

- Personal: HomeDirectory`/.dt/palettes/desc.palettes`
- System-wide: `/etc/dt/palettes/desc.`language
- Built-in: `/usr/dt/palettes/desc.`language

## Localizing Help Volumes

If you have localized a help volume, you must store it in one of the following directories. The first help volume found is the one used. The directories are searched in the following order:

- Personal: HomeDirectory`/.dt/help`
- System-wide: `/etc/dt/appconfig/help/`language
- Built-in: /usr/dt/appconfig/help/language

## Localizing Message Catalogs

If you have localized a message catalog, store it in the following directory:

`/usr/dt/lib/nls/msg/`language.

These directories contain the `*.cat` files.

## Executing Localized Desktop Applications Remotely

You can invoke localized desktop applications on any remote execution host that has a similarly localized desktop installation. The values of the NLS-related environment variables on the host that is invoking the application are passed to the remote host when the application is started. However, the environment variables do not contain any host information.

## Resetting Your Keyboard Map

If you see unexpected characters and behaviors, or characters cannot be displayed or typed, you might need to reset or install your keyboard map or change your input method.

The input method is determined by the LC_CTYPE, LANG, or LC_ALL environment variables, or the language specified by the `-lang` option.

For example, if the user wants to open a terminal with the C locale within a POSIX shell, such as:

    LANG=C   dtterm

This new terminal uses the C locale including the C input method and fonts. If you are using a language-specific keyboard, the input method may not accept any extended characters for input. When using the C locale with a language-specific keyboard, users need to set the LC_CTYPE (or LANG or LC_ALL) environment variable to an appropriate value before invoking the terminal.

For example, to use the C locale with the German keyboard, type:

    LANG=C LC_CTYPE=DeDE dtterm

If the X server has been reset and keymaps have been initialized, you can reset the proper keyboard map at the server using the `xmodmap` command.

Generated with CERN WebMaker