1 |
On Thu, 19 Jul 2012 23:37:32 +0800 |
2 |
Ben de Groot <yngwin@g.o> wrote: |
3 |
|
4 |
> I got a few more suggestions on IRC, and I have updated the eclass |
5 |
> accordingly. Please check the attached new version, also available at |
6 |
> https://gitorious.org/gentoo-qt/qt/blobs/master/eclass/l10n.eclass |
7 |
|
8 |
Pseudo inlining |
9 |
|
10 |
> # Add linguas useflags |
11 |
> if [[ -n "${PLOCALES}" ]]; then |
12 |
> for u in ${PLOCALES}; do |
13 |
> IUSE+=" linguas_${u}" |
14 |
> done |
15 |
> fi |
16 |
|
17 |
no need to guard the loop against empty $PLOCALES. |
18 |
|
19 |
> l10n_for_each_locale_do() { |
20 |
> local locs x |
21 |
> locs=$(l10n_get_locales) |
22 |
> if [[ -n "${locs}" ]]; then |
23 |
> for x in ${locs}; do |
24 |
> ${@} ${x} || die "failed to process enabled |
25 |
> ${x} locale" done |
26 |
> fi |
27 |
> } |
28 |
|
29 |
same here, no guarding required and "${@}" should be quoted as it may |
30 |
contain args with spaces. Also in l10n_for_each_disabled_locale_do. |
31 |
|
32 |
> # ones. This function is normally used internally in this eclass, not |
33 |
> by # l10n.eclass consumers. |
34 |
> l10n_get_locales() { |
35 |
|
36 |
I'd mark this function @INTERNAL then, at least until someone can |
37 |
presents a use case. |
38 |
If you are sufficiently sure this function shouldn't be used by |
39 |
consumers you could remove the function in favour of 'use linguas_${x} |
40 |
|| continue' in l10n_for_each_locale_do resp 'use linguas_${x} |
41 |
&& continue' in l10n_for_each_disabled_locale_do. |