Gentoo Archives: gentoo-devhelp

From: Nikos Chantziaras <realnc@×××××.de>
To: gentoo-devhelp@l.g.o
Subject: [gentoo-devhelp] Re: LINGUAS vs LANGUAGES
Date: Fri, 15 May 2009 19:16:46
Message-Id: gukf25$h9f$1@ger.gmane.org
In Reply to: Re: [gentoo-devhelp] LINGUAS vs LANGUAGES by Daniel Pielmeier
1 Daniel Pielmeier wrote:
2 > [...]
3 > You also might consider using a loop for installing the linguas else you
4 > have to add the same almost identical block for every new language
5 > introduced. This way the intermediate variable LANGS used for IUSE
6 > injection comes handy.
7 >
8 > # IUSE definition:
9 >
10 > IUSE="flags"
11 >
12 > LANGS="de en"
13 > for i in ${LANGS}; do
14 > IUSE="${IUSE} linguas_${i}"
15 > done
16 >
17 > # in src_install:
18 >
19 > local my_langs
20 >
21 > for j in ${LINGUAS}; do
22 > if has ${j} ${LANGS}; then
23 > my_langs="${j} ${my_langs}"
24 > fi
25 > done
26 >
27 > insinto "${GAMES_DATADIR}/${PN}/i18n"
28 > for k in ${my_langs}; do
29 > doins "${PN}_${k}.qm" || die "doins ${PN}_${k}.qm failed"
30 > done
31
32 Thanks. I ended up doing it this way, though with only one loop in
33 src_install(), which seems to be a bit more efficient and shorter:
34
35
36 LANGUAGES="de"
37 for i in ${LANGUAGES}; do
38 IUSE="${IUSE} linguas_${i}"
39 done
40
41 src_install()
42 #...
43 insinto "${GAMES_DATADIR}/${PN}/i18n"
44 for i in ${LANGUAGES}; do
45 if has ${i} ${LINGUAS}; then
46 doins "${PN}_${i}.qm" || die #...
47 fi
48 done
49
50
51 In this case, LANGUAGES must not include "en" though, since there's no
52 ${PN}_en.qm file (English is built-in). I'm not sure if the following
53 would be better though, in case a user puts linguas_<language> in USE
54 instead of <language> in LINGUAS:
55
56 if has linguas_${i} ${USE}; then
57
58 But I suppose it would be the user's fault if he/she does that? :P

Replies

Subject Author
[gentoo-devhelp] Re: LINGUAS vs LANGUAGES Steven J Long <slong@××××××××××××××××××.uk>