Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Sep 2000 12:41:42 +0900
From:      numa@rp.open.cs.fujitsu.co.jp (NUMATA Toshinori)
To:        "Andrey A. Chernov" <ache@nagual.pp.ru>, Alexander Voropay <a.voropay@globalone.ru>
Cc:        i18n@FreeBSD.ORG, phantom@FreeBSD.ORG
Subject:   Re: Request for review: locale aliases support for libc
Message-ID:  <200009040341.MAA15473@margaux.rp.open.cs.fujitsu.co.jp>
In-Reply-To: <20000901192017.B29804@nagual.pp.ru>
References:  <34d701c01424$4a2e4b60$cd0d11ac@host205.spb.in.rosprin.ru> <20000901192017.B29804@nagual.pp.ru>

next in thread | previous in thread | raw e-mail | index | archive | help
"Andrey A. Chernov" <ache@nagual.pp.ru> wrote:
> On Fri, Sep 01, 2000 at 06:52:03PM +0400, Alexander Voropay wrote:
>>  AFAIK, the presense of any forms of locale "aliasing" does not
>> comply current POSIX specifications :
>>   string=setlocale(LC_xxx, "language_TERRITORY.Codeset");
>> should returns _THE_SAME_ locale name _as requested_.
> 
> 
> No, it means that returned string should be not expanded to its full form.
> 
> I.e. setlocale(LC_ALL, "ru") should return "ru" and not "ru_RU.KOI8-R"
> and do all expansions internally and invisible to caller.

In my copy of POSIX.1 standard (ISO/IEC 9945-1:1990) says:

    8.1.2 Extensions to setlocale() Function
    ...
    8.1.2.3 Returns

    A successful call to setlocale() returns a string that corresponds
    to the locale set.  The string returned is such that "a subsequent
    call with that string and its associated category will restore
    that part of the process's locale" (C Standard {2}).  The string
    returned shall not be modified by the process, but may be
    overwritten by a subsequent call to the setlocale() function.
    This string is not required to be the value of the environment
    variable used, if one was used.

It does not say that the returned value must be the same as the string
passed to the setlocale() call, or anything about string expansions.
(POSIX does ont specify the format of locale names, so no definition
of "locale name expantion" at all.)

The only thing the standard specify is that the call:

    char *locale_string = setlocale(LC_CTYPE, "ru");

must return *some* string that indicates the locale set (if the call was
successful) and the subsequent call:

    setlocale(LC_CTYPE, locale_string);

must produce the same result as the call of setlocale(LC_CTYPE, "ru");.
(Well, the content of locale_string may be changed by the subsequent
calls of setlocale() so the string must be saved to some other buffer.)

The string returned may be the same as the string passed (for example,
"ru"), may be "expanded" form (for example, "ru_RU.KOI-8R"), or may be
some other implementation-specific form.  The only requirement is that
"a subsequent call with that string and its associated category will
restore that part of the process's locale".

-- 
NUMATA Toshinori
Planning Dept., Strategic Planning Div., Software Group, FUJITSU LIMITED
Phone: +81-45-476-4586 (x4224)	Fax: +81-45-476-4749


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-i18n" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200009040341.MAA15473>