[devel] Q: locale(7) hell

Dmitry V. Levin =?iso-8859-1?q?ldv_=CE=C1_altlinux=2Eorg?=
Вт Дек 14 13:30:57 MSK 2004


On Tue, Dec 14, 2004 at 12:05:40PM +0300, Alexey I. Froloff wrote:
> * Alexey I. Froloff <raorn@> [041214 11:29]:
> > Всвязи с этим вопрос - куда девать ГНУтое расширение под
> > названием LANGUAGE?  Вариантов два:
> Посмотрел как сделано в gettext...
> 
> Если есть LANGUAGE - использовать его, при условии что данная
> категория локали не выставлена в "C"...
> 
> Однако берут меня сомнения...  У LC_ALL должен быть самый большой
> приоритет.

В gettext(3) написано следующее:

Translation lookup operates in the context of the current locale.
For the gettext and dgettext functions, the LC_MESSAGES locale facet
is used.  It is determined by a preceding call to the setlocale function.
setlocale(LC_ALL,"") initializes the LC_MESSAGES locale based on the first
nonempty value of the three environment variables LC_ALL, LC_MESSAGES,
LANG; see setlocale(3).  For the dcgettext function, the locale facet
is determined by the category argument, which should be one of the
LC_xxx constants defined in the <locale.h> header, excluding LC_ALL.
In both cases, the functions also use the LC_CTYPE locale facet in
order to convert the translated message from the translator's codeset
to the current locale's codeset, unless overridden by a prior call to
the bind_textdomain_codeset function.

The message catalog used by the functions is at the pathname
dirname/locale/category/domainname.mo.  Here dirname is the directory
specified through bindtextdomain.  Its default is system and configuration
dependent; typically it is prefix/share/locale, where prefix is the
installation prefix of the package.  locale is the name of the current
locale facet; the GNU implementation also tries generalizations, such as
the language name without the territory name.  category is LC_MESSAGES
for the gettext and dgettext functions, or the argument passed to the
dcgettext function.

If the LANGUAGE environment variable is set to a nonempty value, and
the locale is not the "C" locale, the value of LANGUAGE is assumed
to contain a colon separated list of locale names.  The functions will
attempt to look up a translation of msgid in each of the locales in turn.
This is a GNU extension.

Было бы разумно реализовать аналогичное поведение.


-- 
ldv
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Тип     : application/pgp-signature
Размер  : 189 байтов
Описание: =?iso-8859-1?q?=CF=D4=D3=D5=D4=D3=D4=D7=D5=C5=D4?=
Url     : <http://lists.altlinux.org/pipermail/devel/attachments/20041214/4c035324/attachment-0001.bin>


Подробная информация о списке рассылки Devel