Hi.

We have LINGUAS support in portage for quite some time now, but how do
we handle LINGUAS? It's not as evident as it seems and thus we need some
guidelines. So I'll formulate few questions below but first let's look
how portage works with LINGUAS. If you know this skip to Questions
section below.


Portage/gettext
---------------

Like USE variable LINGUAS value could be set by user in /etc/make.conf,
package.keywords or environment. There are three different cases: 1)
LINGUAS set to some value, 2) LINGUAS set and contains '*'[1] 3) LINGUAS
unset. portage will treat this cases differently for ebuilds with
linguas_<lang> in IUSE and without. This makes 6 cases:

1. In case LINGUAS is set and ebuild has no linguas_<lang> in IUSE
portage exports LINGUAS as is.

2. In case LINGUAS is set and IUSE contains linguas_<lang> portage
exports intersection of languages in LINGUAS and IUSE. E.g. LINGUAS set
to "lang1 lang2" and IUSE contains "linguaus_<lang1> linguaus_<lang3>"
portage will export LINGUAS="lang1".

3. In case LINGUAS contains '*' and there is no linguaus_<lang> in IUSE
portage unsets LINGUAS.

4. In case LINGUAS contains '*' and IUSE contains linguas_<lang> portage
exports LINGUAS with langs defined in the IUSE's linguas_<lang>.

5. If LINGUAS is unset and ebuild has no linguas_<lang> flag portage
unsets LINGUAS.

6. In case LINGUAS is unset and IUSE contains linguas_<lang> portage
exports LINGUAS="".

                |    ebuild contains linguas_<lang> the IUSE      |
                --------------------------------------------------|
                |          no         |            yes            |
-------------------------------------------------------------------
LINGUAS unset   |    LINGUAS unset    |        LINGUAS=''         |
------------------------------------------------------------------|
LINGUAS has '*' |    LINGUAS unset    |      LINGUAS='lang'       |
-------------------------------------------------------------------
LINGUAS set     |LINGUAS set literally|LINGUAS set to intersection|
                |                     |of lang in IUSE and LINGUAS|
-------------------------------------------------------------------

BTW, I guess all above is applicable to all USE_EXPANDED variables.

But unlike other variables LINGUAS is used by gettext and in case it is
unset gettext installs all translations.


Questions
---------

1. Do we want all packages to support LINGUAS if possible? It is
possible to leave gettext based package without LINGUAS and everything
will just work, but I think that it's good idea to make supported
languages visible to user through linguas_<lang> flags.

2. How should we handle case of unset LINGUAS in ebuild? Should we mimic
gettext and install all supported languages, using code like

LINGUAS=${LINGUAS-%UNSET%}
if test "%UNSET%" == "$LINGUAS"; then
        # install all supported languages
fi

? If yes, it's easy to write such code and put in eclass. If no, how do
we live with inconsistency that some packages will install all languages
some, will install nothing (document in handbook and add portage warning
in case LINGUAS is unset?)?

3. What is the purpose of strip-linguas function (mentioned in
devmanual)? It's clear what it does but I have no ideas why. Probably
similar code could be used in QA function that will gather supported
languages from po directories and warn maintainer that it's time to
update linguas_<lang> in IUSE (and probably later it could be expanded
to support qt packages too).



[1] or equivalently linguas_* is set in package.use

-- 
Peter.



Reply via email to