The locales.conf file

FreeTDS User Guide: A Guide to Installing, Configuring, and Running FreeTDS
Prev | Chapter 3. Install FreeTDS | Next

# The `locales.conf` file

## What it does

For an English-speaking American, not much. FreeTDS originated in the United States, and uses U.S. conventions if no `locales.conf` is present. The `locales.conf` provided with the installation also reflects these conventions.

| `locales.conf` will probably be dropped from FreeTDS one day. Its only real purpose now is to control the format of date strings. The Right Way™ to deduce the appropriate default date format is from the application's locale settings, while allowing an override in `freetds.conf`. That's the direction we're headed. If your purpose is to affect the client charset description, use `freetds.conf` instead.

Information on locales and locale strings is easily (even too easily!) found on the Internet, or see man locale for your system. FreeTDS will examine its environment for a `LOCALE` string. If it finds one, it will look it up in `locales.conf` to find your preferred settings. If it fails to find one, it will use its defaults.

## Where it goes

Like `freetds.conf`, the location of `locales.conf` is determined by the value of `--sysconfdir` to configure. The default is `PREFIX/etc`.

## What it looks like

The format of `locales.conf` is similar to that of `freetds.conf`. There is a `[default]` section, and a section for each locale. `locales.conf` controls three settings

`date format`

  This entry will be passed (almost) literally to `strftime(3)` to convert dates to strings.

  For the most part, see you system documentation for `strftime(3)` (man 3 strftime). You will see there though that `strftime(3)` has no provision for milliseconds. The `locales.conf` format string uses `%z` for milliseconds.

  | If your system's `strftime(3)` does employ `%z` for its own use, it will not be given that chance by FreeTDS. FreeTDS will consume the `%z` for its milliseconds needs, and will not pass it on to `strftime(3)`.

`language`

  The language that will be used for error/status messages from the server. A SQL Server client can specify a language for such messages at login time.

  | FreeTDS issues a few messages of its own. Messages from the server are called "messages"; those from the client library (i.e., from FreeTDS) are called "error messages". FreeTDS-issued messages are not affected by `locales.conf`.

`charset`

  Indicates to the server what character set should be used for communicating with the client.

Prev | Home | Next
The `freetds.conf` file | Up | Environment variables