The locales.dat file

The locales file, called locales.dat, provides platform-specific locale information in a Sybase proprietary format. This file associates locale names with languages, character sets and collating sequences.

How it is used

Open Client applications use locales.dat to determine what localization information to load. The locales.dat file directs Open Client applications to localization information, but it does not contain actual localized messages or character set information.

Location of locales.dat

The locales.dat file is located in the $SYBASE/locales directory. See “Localization files” for a diagram of the $SYBASE/locales directory structure.

locales.dat sections and entries

locales.dat contains platform-specific sections, each of which contains predefined locale definition entries. These entries vary by platform, but all sections include an entry defining a “default” locale.

Locale definition entries have the form:

locale = locale_name, language_name, charset_name [,sortorder_name]

where:

The following locales.dat file entry specifies a French locale. Because no sort order is specified, the default sort order “binary” is used with this locale:

locale = fr.FR.88591, french, iso_1

locales.dat file sample

The following portion of locales.dat illustrates a platform-specific section:

[aix]

      locale = C, us_english, iso_1
      locale = En_US, us_english, iso_1
      locale = en_US, us_english, iso_1
      locale = default, us_english, iso_1
      locale = japanese.sjis, japanese, sjis
      locale = japanese, japanese, eucjis
      locale = us_english.utf8, us_english, utf8

Editing locales.dat

If the predefined entries in locales.dat do not meet your needs, edit the file with an operating system editor such as vi.

WARNING! Before you edit, make a copy of the original locales.dat. The copy will help you solve any problems with the edited version. Also, review the entries for your platform to see if an entry already exists.

Edit locales.dat to:

To add a new entry to locales.dat or to change an existing entry:

  1. Choose any value for locale_name.

  2. Determine the value for language_name.

    When a Sybase language module is installed, a subdirectory for the language is created in the locales/message directory of the Sybase directory tree. language_name must correspond to this subdirectory’s name.

  3. Determine the value for charset_name.

    When a Sybase language module is installed, subdirectories for each supported character set are created in the charsets directory of the Sybase directory tree. charset_name must correspond to one of these subdirectory names.

  4. Determine the value for sortorder_name (if you want a sort order other than binary).

    The charsets/charset_name subdirectory contains the sort order (*.srt) files for the character set. sortorder_name must correspond to one of these file names (without the .srt).

  5. In the appropriate platform-specific section of the locales.dat file, type in or change the appropriate entry.

    Update localization environment variables (LC_ALL, LC_CTYPE, LC_MESSAGE, LC_TIME, LANG) as appropriate.

If you have added a new locale name and you want existing applications to use this new name in cs_locale calls, edit and recompile the applications as appropriate.

NoteIt is not necessary to delete entries from locales.dat, even if applications no longer use them. If you decide to delete an entry, make sure no application uses it.