Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Fri, 05 Jan 2018 15:38:43
Message-Id: 1515166708.d2b35d386291d6b34b108cbb0895460ec5ef80a1.ulm@gentoo
1 commit: d2b35d386291d6b34b108cbb0895460ec5ef80a1
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 29 16:38:05 2017 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Fri Jan 5 15:38:28 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2b35d38
7
8 l10n.eclass: Update for unexpanded LINGUAS.
9
10 eclass/l10n.eclass | 42 ++++++++++++++++++++++--------------------
11 1 file changed, 22 insertions(+), 20 deletions(-)
12
13 diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass
14 index 2283088d0d0..4b0111934d7 100644
15 --- a/eclass/l10n.eclass
16 +++ b/eclass/l10n.eclass
17 @@ -1,4 +1,4 @@
18 -# Copyright 1999-2016 Gentoo Foundation
19 +# Copyright 1999-2017 Gentoo Foundation
20 # Distributed under the terms of the GNU General Public License v2
21
22 # @ECLASS: l10n.eclass
23 @@ -12,8 +12,7 @@
24 # conveniently handle localizations (translations) offered by packages.
25 # These are meant to prevent code duplication for such boring tasks as
26 # determining the cross-section between the user's set LINGUAS and what
27 -# is offered by the package; and generating the right list of linguas_*
28 -# USE flags.
29 +# is offered by the package.
30
31 # @ECLASS-VARIABLE: PLOCALES
32 # @DEFAULT_UNSET
33 @@ -33,11 +32,6 @@
34 #
35 # Example: PLOCALE_BACKUP="en_US"
36
37 -# Add linguas useflags
38 -for u in ${PLOCALES}; do
39 - IUSE+=" linguas_${u}"
40 -done
41 -
42 # @FUNCTION: l10n_for_each_locale_do
43 # @USAGE: <function>
44 # @DESCRIPTION:
45 @@ -103,23 +97,31 @@ l10n_find_plocales_changes() {
46 # @FUNCTION: l10n_get_locales
47 # @USAGE: [disabled]
48 # @DESCRIPTION:
49 -# Determine which LINGUAS USE flags the user has enabled that are offered
50 -# by the package, as listed in PLOCALES, and return them. In case no locales
51 -# are selected, fall back on PLOCALE_BACKUP. When the disabled argument is
52 -# given, return the disabled useflags instead of the enabled ones.
53 +# Determine which LINGUAS the user has enabled that are offered by the
54 +# package, as listed in PLOCALES, and return them. In case no locales
55 +# are selected, fall back on PLOCALE_BACKUP. When the disabled argument
56 +# is given, return the disabled locales instead of the enabled ones.
57 l10n_get_locales() {
58 local disabled_locales enabled_locales loc locs
59 - for loc in ${PLOCALES}; do
60 - if use linguas_${loc}; then
61 - enabled_locales+="${loc} "
62 - else
63 - disabled_locales+="${loc} "
64 - fi
65 - done
66 + if [[ -z ${LINGUAS+set} ]]; then
67 + # enable all if unset
68 + enabled_locales=${PLOCALES}
69 + elif [[ -z ${LINGUAS} ]]; then
70 + # disable all if empty
71 + disabled_locales=${PLOCALES}
72 + else
73 + for loc in ${PLOCALES}; do
74 + if has ${loc} ${LINGUAS}; then
75 + enabled_locales+="${loc} "
76 + else
77 + disabled_locales+="${loc} "
78 + fi
79 + done
80 + fi
81 if [[ ${1} == disabled ]]; then
82 locs=${disabled_locales}
83 else
84 - locs=${enabled_locales:-$PLOCALE_BACKUP}
85 + locs=${enabled_locales:-${PLOCALE_BACKUP}}
86 fi
87 printf "%s" "${locs}"
88 }