Re: Commit: ut_locale.cpp,h

From: Andrew Dunbar (
Date: Thu Oct 31 2002 - 21:30:38 EST

  • Next message: Dom Lachowicz: "Announce: Weekly Patch Prize"

     --- Dom Lachowicz <> wrote:
    > New files. Contains 2 classes:
    > UT_LocaleTransactor. Like the MutexAcquirer, it acts
    > to transact the
    > locale setting. so you might use it like this:
    > UT_LocaleTransactor trans(LC_NUMERIC, "C");
    > sprintf(str, "%f", args);
    > return; // locale implicitly rolled back

    I believe the STL now has something kinda like this

    > ------------
    > UT_LangInfo. Has 2 meaningful constructors:
    > UT_LangInfo() <-- gets your language from $LANG
    > UT_LangInfo(const char *lang) <-- get language from
    > passed string
    > $LANG can be something like:
    > "en", "en_US", "en_US.utf-8", "en.utf-8", "en-US",
    > "en-US.UTF-8"

    Does it actually come straight from $LANG or does it
    come from the internally cached values parsed from
    $LANG at program initialization? I ask this because
    the Windows code acts in an equivalent manner but of
    course has no $LANG variable. What does this new code
    do on a Windows (or other) system?

    > There are 6 methods:
    > hasLanguageField, getLanguage
    > hasTerritoryField, getTerritory
    > hasEncodingField, getEncoding

    Also remember that the Unix locale can have one more
    field, often in practice it tends to be "@euro" where
    "@" is the field separator and "euro" is the
    This field is a bit vague though ):

    Another thing is that the encoding field does not tell
    us everything we need to know about the encodings
    needed on any particular system. Specifically the
    GUI can use a different encoding and on some non-Unix
    but Unix-like systems, the filesystem may also use
    UTF-8 I believe.

    > I hope to use this class in order to help sanitize
    > the strings mess, the spell checking mess, the
    > system.profile mess, the help files mess, among
    > other things.

    Good luck!

    > Dom


    Do You Yahoo!?
    Everything you'll ever need on one web page
    from News and Sport to Email and Music Charts

    This archive was generated by hypermail 2.1.4 : Thu Oct 31 2002 - 21:39:09 EST