1 |
commit: 32512ee7aaabe65b95842536ff48a61fdfe06a94 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 3 16:45:57 2016 +0000 |
4 |
Commit: Johannes Huber <johu <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 3 16:45:57 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=32512ee7 |
7 |
|
8 |
kde4-*.eclass: Migrate to L10N flags |
9 |
|
10 |
Signed-off-by: Johannes Huber <johu <AT> gentoo.org> |
11 |
|
12 |
eclass/kde4-base.eclass | 4 ++-- |
13 |
eclass/kde4-functions.eclass | 43 +++++++++++++++++++++++++++---------------- |
14 |
2 files changed, 29 insertions(+), 18 deletions(-) |
15 |
|
16 |
diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass |
17 |
index f5e2c61..59a1932 100644 |
18 |
--- a/eclass/kde4-base.eclass |
19 |
+++ b/eclass/kde4-base.eclass |
20 |
@@ -341,13 +341,13 @@ fi |
21 |
|
22 |
# add a dependency over kde4-l10n |
23 |
if [[ ${KDEBASE} != "kde-base" && -n ${KDE_LINGUAS} ]]; then |
24 |
- for _lingua in ${KDE_LINGUAS}; do |
25 |
+ for _lingua in $(kde4_lingua_to_l10n ${KDE_LINGUAS}); do |
26 |
# if our package has linguas, pull in kde4-l10n with selected lingua enabled, |
27 |
# but only for selected ones. |
28 |
# this can't be done on one line because if user doesn't use any localisation |
29 |
# then he is probably not interested in kde4-l10n at all. |
30 |
kderdepend+=" |
31 |
- linguas_${_lingua}? ( $(add_kdeapps_dep kde4-l10n "linguas_${_lingua}(+)") ) |
32 |
+ l10n_${_lingua}? ( $(add_kdeapps_dep kde4-l10n "l10n_${_lingua}(+)") ) |
33 |
" |
34 |
done |
35 |
unset _lingua |
36 |
|
37 |
diff --git a/eclass/kde4-functions.eclass b/eclass/kde4-functions.eclass |
38 |
index 8c2fa4a..a600d55 100644 |
39 |
--- a/eclass/kde4-functions.eclass |
40 |
+++ b/eclass/kde4-functions.eclass |
41 |
@@ -76,6 +76,27 @@ case ${KDE_SCM} in |
42 |
*) die "KDE_SCM: ${KDE_SCM} is not supported" ;; |
43 |
esac |
44 |
|
45 |
+# @FUNCTION: kde4_lingua_to_l10n |
46 |
+# @USAGE: <lingua>... |
47 |
+# @INTERNAL |
48 |
+# @DESCRIPTION: |
49 |
+# Output l10n flag name(s) (without prefix(es)) appropriate for given KDE |
50 |
+# locale(s). |
51 |
+kde4_lingua_to_l10n() { |
52 |
+ local l |
53 |
+ for l; do |
54 |
+ case ${l} in |
55 |
+ ca@valencia) echo ca-valencia;; |
56 |
+ sr@ijekavian) echo sr-ijekavsk;; |
57 |
+ sr@ijekavianlatin) echo sr-Latn-ijekavsk;; |
58 |
+ sr@latin|sr@Latn) echo sr-Latn;; |
59 |
+ uz@cyrillic) echo uz-Cyrl;; |
60 |
+ *@*) die "${FUNCNAME}: Unhandled KDE_LINGUAS: ${l}";; |
61 |
+ *) echo "${l/_/-}";; |
62 |
+ esac |
63 |
+ done |
64 |
+} |
65 |
+ |
66 |
# @ECLASS-VARIABLE: KDE_LINGUAS |
67 |
# @DESCRIPTION: |
68 |
# This is a whitespace-separated list of translations this ebuild supports. |
69 |
@@ -86,8 +107,8 @@ esac |
70 |
# |
71 |
# Example: KDE_LINGUAS="de en_GB nl" |
72 |
if [[ ${KDE_BUILD_TYPE} != live || -n ${KDE_LINGUAS_LIVE_OVERRIDE} ]]; then |
73 |
- for _lingua in ${KDE_LINGUAS}; do |
74 |
- IUSE="${IUSE} linguas_${_lingua}" |
75 |
+ for _lingua in $(kde4_lingua_to_l10n ${KDE_LINGUAS}); do |
76 |
+ IUSE="${IUSE} l10n_${_lingua}" |
77 |
done |
78 |
fi |
79 |
|
80 |
@@ -139,7 +160,7 @@ comment_all_add_subdirectory() { |
81 |
|
82 |
# @FUNCTION: enable_selected_linguas |
83 |
# @DESCRIPTION: |
84 |
-# Enable translations based on LINGUAS settings and translations supported by |
85 |
+# Enable translations based on L10N settings and translations supported by |
86 |
# the package (see KDE_LINGUAS). By default, translations are found in "${S}"/po |
87 |
# but this default can be overridden by defining KDE_LINGUAS_DIR. |
88 |
enable_selected_linguas() { |
89 |
@@ -147,11 +168,6 @@ enable_selected_linguas() { |
90 |
|
91 |
local x |
92 |
|
93 |
- # if there is no linguas defined we enable everything |
94 |
- if ! $(env | grep -q "^LINGUAS="); then |
95 |
- return 0 |
96 |
- fi |
97 |
- |
98 |
# @ECLASS-VARIABLE: KDE_LINGUAS_DIR |
99 |
# @DESCRIPTION: |
100 |
# Specified folder where application translations are located. |
101 |
@@ -171,7 +187,7 @@ enable_selected_linguas() { |
102 |
|
103 |
# @FUNCTION: enable_selected_doc_linguas |
104 |
# @DESCRIPTION: |
105 |
-# Enable only selected linguas enabled doc folders. |
106 |
+# Enable only selected L10N enabled doc folders. |
107 |
enable_selected_doc_linguas() { |
108 |
debug-print-function ${FUNCNAME} "$@" |
109 |
|
110 |
@@ -195,11 +211,6 @@ enable_selected_doc_linguas() { |
111 |
-e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${handbookdir}[[:space:]]*)/s/^/#DONOTCOMPILE /" \ |
112 |
-i CMakeLists.txt || die 'failed to comment out all handbooks' |
113 |
else |
114 |
- # if there is no linguas defined we enable everything (i.e. comment out nothing) |
115 |
- if ! $(env | grep -q "^LINGUAS="); then |
116 |
- return 0 |
117 |
- fi |
118 |
- |
119 |
# Disable subdirectories recursively |
120 |
comment_all_add_subdirectory "${handbookdir}" |
121 |
|
122 |
@@ -213,7 +224,7 @@ enable_selected_doc_linguas() { |
123 |
# Add requested translations |
124 |
local lingua |
125 |
for lingua in en ${KDE_LINGUAS}; do |
126 |
- if [[ ${lingua} = en ]] || use linguas_${lingua}; then |
127 |
+ if [[ ${lingua} = en ]] || use "l10n_$(kde4_lingua_to_l10n "${lingua}")"; then |
128 |
if [[ -d ${handbookdir}/${translationdir//%lingua/${lingua}} ]]; then |
129 |
sed -e "/add_subdirectory[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \ |
130 |
-e "/ADD_SUBDIRECTORY[[:space:]]*([[:space:]]*${translationdir//%lingua/${lingua}}/s/^#DONOTCOMPILE //" \ |
131 |
@@ -376,7 +387,7 @@ _enable_selected_linguas_dir() { |
132 |
done |
133 |
|
134 |
for lingua in ${KDE_LINGUAS}; do |
135 |
- if use linguas_${lingua} ; then |
136 |
+ if use "l10n_$(kde4_lingua_to_l10n ${lingua})" ; then |
137 |
if [[ -d ${lingua} ]]; then |
138 |
linguas="${linguas} ${lingua}" |
139 |
sed -e "/add_subdirectory([[:space:]]*${lingua}[[:space:]]*)[[:space:]]*$/ s/^#DONOTCOMPILE //" \ |