Gentoo Archives: gentoo-devhelp

From: Steven J Long <slong@××××××××××××××××××.uk>
To: gentoo-devhelp@l.g.o
Subject: [gentoo-devhelp] Re: LINGUAS vs LANGUAGES
Date: Tue, 21 Jul 2009 10:15:51
Message-Id: 23125183.lyQsYuCQA3@news.friendly-coders.info
In Reply to: [gentoo-devhelp] Re: LINGUAS vs LANGUAGES by Nikos Chantziaras
1 Nikos Chantziaras wrote:
2
3 > Thanks. I ended up doing it this way, though with only one loop in
4 > src_install(), which seems to be a bit more efficient and shorter:
5 >
6 >
7 > LANGUAGES="de"
8 > for i in ${LANGUAGES}; do
9 > IUSE="${IUSE} linguas_${i}"
10 > done
11 >
12 Just on a side-note (not saying it's how you want to do this one), this is
13 something that BASH arrays are nice for (saving another loop):
14 $ foo=(bar baz quux)
15 $ echo "prefixed: '${foo[*]/#/pfx_}'"
16 prefixed: 'pfx_bar pfx_baz pfx_quux'
17
18 Parameter Expansion (incl on arrays) is discussed more at:
19 http://mywiki.wooledge.org/BashFAQ/073
20
21 > src_install()
22 > #...
23 > insinto "${GAMES_DATADIR}/${PN}/i18n"
24 > for i in ${LANGUAGES}; do
25 > if has ${i} ${LINGUAS}; then
26 > doins "${PN}_${i}.qm" || die #...
27 > fi
28 > done
29 >
30 >
31 > In this case, LANGUAGES must not include "en" though, since there's no
32 > ${PN}_en.qm file (English is built-in). I'm not sure if the following
33 > would be better though, in case a user puts linguas_<language> in USE
34 > instead of <language> in LINGUAS:
35 >
36 > if has linguas_${i} ${USE}; then
37 >
38 > But I suppose it would be the user's fault if he/she does that? :P
39
40 Well yeah it's not the right way to set USE_EXPAND vars; LINGUAS is, and
41 will be handled specially since it's one of that set.
42 --
43 #friendly-coders -- We're friendly but we're not /that/ friendly ;-)

Replies

Subject Author
Re: [gentoo-devhelp] Re: LINGUAS vs LANGUAGES Mike Frysinger <vapier@g.o>
[gentoo-devhelp] Re: LINGUAS vs LANGUAGES Nikos Chantziaras <realnc@×××××.de>