Skip to Content.
Sympa Menu

freetds - Re: [freetds] How to set locales.conf in spanish

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James K. Lowden" <jklowden AT schemamania.org>
  • To: TDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] How to set locales.conf in spanish
  • Date: Sat, 11 Jan 2003 18:28:23 -0500

On Fri, 10 Jan 2003 21:57:47 -0500, "Coleman, Dave"
<DColeman AT US.TIAuto.com> wrote:
> Is it possible to set these at run time?
>
> I would like to be able to set 'en_MX', 'en_US' and 'sp_MX' after the
> creation of the TDS_SOCKET*/LOGIN*/LOCALE* bundle. Theoretically I
> should be able to set those values before I tds_send_login(...), right?

If you mean the environment strings, from what I've read, you need to set
those values before your application starts up, if you want portable code.
Different libc implementations react differently (or not at all) to
changes in the environment once the application starts. I think I read
about that in perl's documentation.

If you mean calling setlocale(3), yes, that has to happen before
tds_send_login(). Not that we pay any attention atm, whatever you do.

In any case, I'm not you can affect very much after connecting.
dbsetlnatlang() for example has to be called before dbopen().

I intend to split off reading the configuration information from the login
function, by the way. It's messy as it is, if I may say so. You can't
query the library for, say, available servers (dbserverenum() for
Microsoft), nor can you find out, say, what TDS version will be used to
connect to a server without trying it and looking at the log. I've
written a standalone library, libnvp, that reads any freetds.conf-like
file and stores it in memory. The application can then query it by key.
I haven't incorporated it yet or released it separately because it lacks
documentation, because I haven't installed doxygen, because I want to
upgrade my OS and release 0.61 first.... Sigh.

--jkl

> -----Original Message-----
> From: James K. Lowden
> To: freetds AT lists.ibiblio.org
> Sent: 1/10/03 11:36 AM
> Subject: Re: [freetds] How to set locales.conf in spanish
>
> On Thu, 9 Jan 2003 21:42:09 -0800 (PST), Aliet Santiesteban Sifontes
> <alietss AT yahoo.com> wrote:
> > I'm trying to configure my
> > locales.conf to be spanish rather english, so I can
> > use the spanish language, anybody could tell me what
> > do I have to do??
>
> Aliet,
>
> Thank you for asking that question. I've been meaning to redo that page
> in the User Guide, and, as a matter of fact, I think we need to redo
> some
> of the code, too.
>
> locales.conf is not intended to be customized; it is a read-only data
> file
> associating national conventions with server settings. It is incomplete
> (in fact it's barely begun), and additions are welcome.
>
> FreeTDS reads the LANG environment variable, and uses it as a key into
> locales.conf. It expects a 5-character value in $LANG: 2 (lowercase)
> for
> the language, an underscore, and 2 (uppercase) for the country. The
> domain of values for language and country is governed by ISO standards.
>
>
> Language codes (ISO 639:1988, now 639-1) are online at
> http://www.loc.gov/standards/iso639-2/langhome.html
>
> Country codes (ISO 3166) are online at
> http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html
>
> For Spanish in Spain, LANG=es_ES.
>
> FreeTDS inspects locales.conf for a section matching $LANG, looking for
> settings for the date format, language, and character set.
>
> The date format string, as the UG says, is used by strftime(3). Set it
> in
> accordance with your country's standard representation. (Your personal
> preference, if different, would be reflected in freetds.conf, which will
> override the locales.conf setting.)
>
> The language, and character set are sent to the server; their domains
> are
> defined by the vendors.
>
> The language value is sent to the server at login time. It determines
> what language your messages will be in. It does not affect collation.
>
> The character set is sent to Sybase servers (and to Microsoft servers,
> if
> using TDS 4.2). It determines what character set your data will be
> encoded with when sent to the client.




Archive powered by MHonArc 2.6.24.

Top of Page