1 |
--- |
2 |
This is meant to be merged after removal of LINGUAS from USE_EXPAND. |
3 |
|
4 |
Any packages inheriting l10n.eclass but not using any of its functions |
5 |
(i.e. relying only on the global scope snippet that adds linguas_* USE |
6 |
flags) will be updated at the same time. |
7 |
|
8 |
eclass/l10n.eclass | 40 +++++++++++++++++++++------------------- |
9 |
1 file changed, 21 insertions(+), 19 deletions(-) |
10 |
|
11 |
diff --git a/eclass/l10n.eclass b/eclass/l10n.eclass |
12 |
index 2283088d0d0a..d60f7befd0d2 100644 |
13 |
--- a/eclass/l10n.eclass |
14 |
+++ b/eclass/l10n.eclass |
15 |
@@ -1,4 +1,4 @@ |
16 |
-# Copyright 1999-2016 Gentoo Foundation |
17 |
+# Copyright 1999-2017 Gentoo Foundation |
18 |
# Distributed under the terms of the GNU General Public License v2 |
19 |
|
20 |
# @ECLASS: l10n.eclass |
21 |
@@ -12,8 +12,7 @@ |
22 |
# conveniently handle localizations (translations) offered by packages. |
23 |
# These are meant to prevent code duplication for such boring tasks as |
24 |
# determining the cross-section between the user's set LINGUAS and what |
25 |
-# is offered by the package; and generating the right list of linguas_* |
26 |
-# USE flags. |
27 |
+# is offered by the package. |
28 |
|
29 |
# @ECLASS-VARIABLE: PLOCALES |
30 |
# @DEFAULT_UNSET |
31 |
@@ -33,11 +32,6 @@ |
32 |
# |
33 |
# Example: PLOCALE_BACKUP="en_US" |
34 |
|
35 |
-# Add linguas useflags |
36 |
-for u in ${PLOCALES}; do |
37 |
- IUSE+=" linguas_${u}" |
38 |
-done |
39 |
- |
40 |
# @FUNCTION: l10n_for_each_locale_do |
41 |
# @USAGE: <function> |
42 |
# @DESCRIPTION: |
43 |
@@ -103,19 +97,27 @@ l10n_find_plocales_changes() { |
44 |
# @FUNCTION: l10n_get_locales |
45 |
# @USAGE: [disabled] |
46 |
# @DESCRIPTION: |
47 |
-# Determine which LINGUAS USE flags the user has enabled that are offered |
48 |
-# by the package, as listed in PLOCALES, and return them. In case no locales |
49 |
-# are selected, fall back on PLOCALE_BACKUP. When the disabled argument is |
50 |
-# given, return the disabled useflags instead of the enabled ones. |
51 |
+# Determine which LINGUAS the user has enabled that are offered by the |
52 |
+# package, as listed in PLOCALES, and return them. In case no locales |
53 |
+# are selected, fall back on PLOCALE_BACKUP. When the disabled argument |
54 |
+# is given, return the disabled locales instead of the enabled ones. |
55 |
l10n_get_locales() { |
56 |
local disabled_locales enabled_locales loc locs |
57 |
- for loc in ${PLOCALES}; do |
58 |
- if use linguas_${loc}; then |
59 |
- enabled_locales+="${loc} " |
60 |
- else |
61 |
- disabled_locales+="${loc} " |
62 |
- fi |
63 |
- done |
64 |
+ if [[ -z ${LINGUAS+set} ]]; then |
65 |
+ # enable all if unset |
66 |
+ enabled_locales=${PLOCALES} |
67 |
+ elif [[ -z ${LINGUAS} ]]; then |
68 |
+ # disable all if empty |
69 |
+ disabled_locales=${PLOCALES} |
70 |
+ else |
71 |
+ for loc in ${PLOCALES}; do |
72 |
+ if has ${loc} ${LINGUAS}; then |
73 |
+ enabled_locales+="${loc} " |
74 |
+ else |
75 |
+ disabled_locales+="${loc} " |
76 |
+ fi |
77 |
+ done |
78 |
+ fi |
79 |
if [[ ${1} == disabled ]]; then |
80 |
locs=${disabled_locales} |
81 |
else |
82 |
-- |
83 |
2.15.1 |