[devel] menu DURING_INSTALL

Alexey Tourbin =?iso-8859-1?q?at_=CE=C1_altlinux=2Eru?=
Вт Ноя 11 15:56:25 MSK 2008


On Tue, Nov 11, 2008 at 03:39:36PM +0300, Alexey I. Froloff wrote:
> * Alexey Tourbin <at@> [081111 15:21]:
> > Согласно locale(7), в качестве языка для надписей меню надо выбирать
> > сначала LC_ALL, потом (если LC_ALL пустой) LC_MESSAGES, LANGUAGE, потом
> > LANG, потом "C".
> LANGUAGE - GNU'тое расширение, и в locale(7) про него ни слова не
> написано.  man-pages-3.09-alt1.

       LC_MESSAGES
	      changes  the  language messages are displayed in and what
	      an affirmative or negative answer looks like.  The GNU
	      C-library contains the gettext(3), ngettext(3), and
	      rpmatch(3) functions to ease the use of  these
	      information.  The GNU gettext family of functions also
	      obey the environment variable LANGUAGE.

...

       If  the second argument to setlocale(3) is empty string, "", for
       the default locale, it is determined using the follow‐ ing steps:

       1.     If there is a non-null environment variable LC_ALL, the
       value of LC_ALL is used.

       2.     If an environment variable with the same name as one of
       the categories above exists and is non-null,  its  value is used
       for that category.

       3.     If there is a non-null environment variable LANG, the
       value of LANG is used.

Если следовать этому алгоритму выбора дефолтной локали, тогда надо:
в силу 1 смотреть LC_ALL; далее в силу 2 смотреть LC_MESSAGES (категория
надписей); далее в силу дополнения к LC_MESSAGES смотреть LANGUAGE;
в силу 3 смотреть LANG.

Как, имея на руках /etc/sysconfig/i18n, прописать язык в
/etc/menu/methods/lang.h?

У меня пока получается так:

	unset LC_ALL LC_MESSAGES LANGUAGE LANG
	. /etc/sysconfig/i18n
	lang=${LC_ALL:-${LC_MESSAGES:-${LANGUAGE:-${LANG:-"C"}}}}

Предлагайте исправленный вариант.

> Во-первых там список, во вторых оно таки игнорирует LC_ALL,
> LC_xxx и LANG, если локаль не C.
> 
> http://www.gnu.org/software/automake/manual/gettext/The-LANGUAGE-variable.html
> 
> This is done through a different environment variable, called
> LANGUAGE. GNU gettext gives preference to LANGUAGE over LC_ALL
> and LANG for the purpose of message handling, but you still need
> to have LANG (or LC_ALL) set to the primary language; this is
> required by other parts of the system libraries. For example,
> some Swedish users who would rather read translations in German
> than English for when Swedish is not available, set LANGUAGE to
> 'sv:de' while leaving LANG to 'sv_SE'.
> 
> Note: The variable LANGUAGE is ignored if the locale is set to
> 'C'. In other words, you have to first enable localization, by
> setting LANG (or LC_ALL) to a value other than 'C', before you
> can use a language priority list through the LANGUAGE variable. 

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


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