This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

missing API for locale_t in <locale.h>


Hi,

With the current public API for locale_t in <locale.h> (newlocale, uselocale,
etc.) it is possible to make the built-in functions of libc behave according
to a per-thread locale. But it is not possible to make user-written functions
behave in the same way!

How is it possible to write a my_gettext() function that looks up a
message catalog in   /usr/local/share/locale/<ll_CC>/LC_MESSAGES/domain.mo
where <ll_CC> is derived from the name of the LC_MESSAGES category of the
current thread's locale? There is no API to retrieve the names of the current
thread's locale!

I could of course access uselocale(NULL)->__names[LC_MESSAGES], but the
comment in <xlocale.h> says that the elements of *__locale_t cannot be
relied upon. (Indeed it is quite probable that 13 = __LC_LAST is increased
some day.)

Also, nl_langinfo_l allows to retrieve the codeset of each locale category,
but not its name.

In short, I'm asking for __current_locale_name to be made public. Or for
nl_langinfo_l to be extended to support _NL_ADDRESS_NAME, _NL_CTYPE_NAME,
_NL_MESSAGES_NAME, etc.

Bruno


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]